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 |
dadas#include <iostream.h> void main() { int j=0,n; int *p=new int[]; int *e=new int[]; int *i=new int[]; int *d=new int[]; int *z=new int[]; do {j++; cin>>p[j]>>e[j]>>i[j]>>d[j]; }while(p[j]!=-1&&e[j]!=-1&&i[j]!=-1&&d[j]!=-1); n=j; for(j=1;j<n;j++) {int l; for(l=1;l<1000;l++) { z[j]=p[j]+l*23-d[j]; if(((p[j]+l*23-e[j])%28==0)&&((p[j]+l*23-i[j])%33==0))break;} } for(j=1;j<n;j++) cout<<"Case "<<j<<":"<<"the next triple peak occurs in "<<z[j]<<" days."<<endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator