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

nnd,把一堆保护都删掉就AC了, 真是画蛇添足

Posted by sunmoonstar_love at 2005-08-21 16:02:33 on Problem 1006
In Reply To:WA了十几次了,受不了了,哪里错了? Posted by:sunmoonstar_love at 2005-08-08 14:44:22
> #include <stdio.h>
> inline int abs(const int &a)
> { return a>0?a:-a; }
> int a,p,e,i,d,ans;
> int main()
> {
>     int ncase=1;
>     while(scanf("%d%d%d%d",&p,&e,&i,&d) && !(p==-1&&e==-1&&i==-1&&d==-1))
>     {
>         if(p==e && p==i)
>         {
>             ans = 21252 + e - d;
>             if(e>d)
>                 ans = e-d;
>             printf("Case %d: the next triple peak occurs in %d days.\n",ncase++,ans);
>             continue;
>         }    
>         for(a=(d-p)/23-1; a<=924; a++)
>             if((23*a+p>d && abs(23*a+p-e)%28==0 && abs(23*a+p-i)%33==0))
>                 break;
>         ans = 23 * a + p - d; 
>         if(ans>21252)
>             ans -= 21252;
>         if(ans<=0)
>             ans += 21252;
>         printf("Case %d: the next triple peak occurs in %d days.\n",ncase++,ans);
>     }  
>     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