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 |
各位抽空给看看吧,杂老是wa,花不了多少时间的,真的谢谢了,再次谢谢了#include<iostream.h> int max(int a,int b,int ,int d); void main () { const int value=365+23*28*33; int a,b,c,i,j=1,days,nowdays; while(cin>>a>>b>>c>>nowdays,!(a==-1&&b==-1&&c==-1&&nowdays==-1)) for(i=max(a,b,c,nowdays)+1;i<=value;i++) if((i-a)%23==0&&(i-b)%28==0&&(i-c)%33==0) { days=i-nowdays; cout<<"Case "<<j<<": the next triple peak occurs in "<<days<<" days."<<endl; j++; break; } } int max(int a,int b,int c,int d) { if(a>=b&&a>=c&&a>=d) return a; if(b>=a&&b>=c&&b>=d) return b; if(c>=a&&c>=b&&c>=d) return c; else return d; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator