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?#include<stdio.h> #define MAX 1000 int main() { int x,p,e,q,d; int i,k,s[MAX]; k=1; while (true) { scanf("%d%d%d%d",&p,&e,&q,&d); if ((p==-1)&&(e=-1)&&(q=-1)&&(d=-1)) break; p=p%23; e=e%28; q=q%33; x=0; while (p+23*x<=21252) { if (((23*x+p-e)%28==0)&&((23*x+p-q)%33==0)&&(p+23*x>=d)) break; x++; } s[k]=p+23*x-d; k++; } for (i=1;i<k;i++) printf("Case %d: the next triple peak occurs in %d days.\n",i,s[i]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator