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> int t(long int p,long int e,long int i,long int d) { long int j=1,k; for(;;++j) { if((p%23==(d+j)%23)&&(e%28==(d+j)%28)&&(i%33==(i+j)%33)) { k=j; break; } } return k; } void main() { long int p[50],e[50],i[50],d[50],N=0; for(;!((p[N-1]==-1) &&(e[N-1]==-1) &&(i[N-1]==-1) &&(d[N-1]==-1));N++) { do{ scanf("%i%i%i%i",&p[N],&e[N],&i[N],&d[N]); }while((p[N]<-1)||(e[N]<-1)||(i[N]<-1)||(d[N]<-1)||(p[N]>365)||(e[N]>365)||(i[N]>365)||(d[N]>365)); } N=0; for(;!((p[N]==-1) &&(e[N]==-1) &&(i[N]==-1) &&(d[N]==-1));N++) { printf("Case %i: the next triple peak occurs in %i days.\n",N+1,t(p[N],e[N],i[N],d[N])); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator