| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
用中国剩余定理固然可以做出来,但请问我这样做怎就wa了呢?麻烦看一下用中国剩余定理固然可以做出来,但请问我这样做怎就wa了呢?麻烦看一下
#include<stdio.h>
int main()
{
int a1,a2,a3,d,day,n,i=0;
while(scanf("%d%d%d%d",&a1,&a2,&a3,&d)!=EOF)
{
if(a1==a2&&a2==a3&&a3==d&&a1==-1)
return 0;
else
{
i++;
n=1;
while(1)
{
day=n*23+a1;
if((day-a2)%28==0&&(day-a3)%33==0&&day-d>0)
break;
else n++;
}
printf("Case %d: the next triple peak occurs in %d days.\n",i,day-d);
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator