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 |
Re: 我也觉得应该不会超啊,可我试很多次了,唉。In Reply To:Re: 我也觉得应该不会超啊,可我试很多次了,唉。 Posted by:Judas at 2005-07-26 08:39:42 Source Problem Id:1006 User Id:Judas Memory:28K Time:1015MS Language:C++ Result:Time Limit Exceed Source #include<iostream.h> int main() { int p=0,e=0,i=0,day=0; int n,sum[50],m; int j=1; while(p != -1) { cin>>p>>e>>i>>day;if (p==-1) break; int d=i; while(d<=21252) { m=d-day; if((d-e)%28==0 && (d-p)%23==0) { if (m<=0) m+=21252; { n=j;sum[j]=m;break; } }d=p+j*33; } j++; } for(j=1;j<=n;j++) cout<<"Case "<<j<<": the next triple peak occurs in "<<sum[j]<<" days."<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator