Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:总结三点

Posted by madebao at 2018-09-23 21:32:23 on Problem 1012
In Reply To:Re:总结三点 Posted by:acm79 at 2012-08-24 16:15:51
> 我怎么解出来的解跟m递增的时候解出来的解不一样呢。。我都输出来看了,有的相同有的不同。。请大牛指教。
> #include <algorithm>
> #include <iostream>
> #include <cstdio>
> #include <cstring>
> #include <cstdlib>
> 
> using namespace std;
> 
> int main()
> {
>     int k,s,p,m,i,ans[14]={0};
>     for(k=1;k<14;k++)
>     {
>         p=0;
>         for(int s=0; ;s++)
>         {
>             m=s*1;
>             //m=s*(k+1);或者m=s*(k+1)+1;的时候算不出正解来,虽然书上是这么说的。
>             for(i=1;i<=k;i++)
>             {
>                 int rest=2*k-i+1;
>                 p=(p+m-1)%rest;
>                 if(p<k)
>                 {
>                     p=0;
>                     break;
>                 }
>             }
>             if(i==k+1)
>             {
>                 ans[k]=m;
>                 break;
>             }
>         }
>         printf("%d\n",ans[k]);
>         system("pause");
>     }
> //    while(scanf("%d",&k),k)
> //    {
> //        printf("%d\n",ans[k]);
> //    }
>     return 0;
> }

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator