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 |
高手们帮帮忙!!!谢谢了#include<stdio.h> #include<math.h> void main() { int n1, n2,n3,a[80],b[80],c[80],d1[80],d,i=0,count=0; for(;;) { scanf("%d%d%d%d%d",&a[i],&b[i],&c[i],&d1[i]); if( a[i]==-1&&b[i]==-1&&c[i]==-1&&d1[i]==-1 ) break; i++;count++; } for(i=0;i<count;i++) { n1=d1[i]/23;n2=d1[i]/28;n3=d1[i]/33; if(33*n3+c[i]<=d1[i]) n3++; if(28*n2+b[i]<=d1[i]) n2++; if(23*n1+a[i]<=d1[i]) n1++; while(33*n3+c[i]<=21252) { if( (23*n1+a[i])==(28*n2+b[i])&&(33*n3+c[i])==(28*n2+b[i]) ) {d=33*n3+c[i]-d1[i];break;} while( abs(33*n3+c[i]-23*(n1+1)-a[i])<=33 ) { while( abs(33*n3+c[i]-28*(n2+1)-b[i])<=33 ) { n2++; if( (23*n1+a[i])==(28*n2+b[i])&&(33*n3+c[i])==(28*n2+b[i]) ) {d=33*n3+c[i]-d1[i];break;} } n1++; } n3++; } printf("Case %d: the next triple peak occurs in %d days.\n",i+1,d); } } 有一组数据通不过,不知怎么回事.... Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator