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<iostream> using namespace std; int main() { int i,d,e,p,a,n=0; while(cin>>d>>e>>p>>a) { ++n; if(d==-1&&e==-1&&p==-1) break; for(i=1;;i++) if((i-d)%23==0&&(i-e)%28==0&&(i-p)%33==0&&i>a) break; cout<<"Case "<<n<<": "<<"the next triple peak occurs in "<<i-a<<" 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