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 |
请高手帮忙看一下我写的第1006题的c语言代码,为什么测评系统给的结果是wrong answer#include <stdio.h> #include <math.h> int a[10000]; int k; void fun(int p, int e, int i,int d) { int j,s1,s2,s3; for(j=d+1;j<=21252;j++) { s1=abs(p-j); s2=abs(e-j); s3=abs(i-j); if(!(s1%23)&&!(s2%28)&&!(s3%33)) { printf("Case %d: the next triple peak occurs in %d days.\n",++k,j-d); break; } } } void main() { int p,e,i,d,j,count=0; while(scanf("%d%d%d%d",&p,&e,&i,&d)==4) { if((p==e)&&(i==d)&&(p==-1)) { for(j=0;j<4*count;) { if(!(j%4)) { p=a[j++]; e=a[j++]; i=a[j++]; d=a[j++]; fun(p,e,i,d); } } break; }else { count++; for(j=(count-1)*4;j<4*count;j++) { a[j++]=p; a[j++]=e; a[j++]=i; a[j++]=d; } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator