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 |
额,发错了,应该是这个In Reply To:请帮忙看看我的代码,所有的测试数据都已通过,该试的也都试过了,拙计 Posted by:wang898jian at 2014-08-16 17:01:48 #include <iostream> using namespace std; int main() { long p=0,e=0,i=0,d=0,colomn=0; int sum[1000]={0}; while(cin>>p>>e>>i>>d) { if (p==-1&&e==-1&&i==-1&&d==-1) { continue; } for (int j=-1;(j<28*23)&&(i+33*j)<21252;j++) { long k = i+33*j; if (((k-e)%28==0)&&((k-p)%23==0)) { if ((k-d)<=0) { sum[colomn]=k-d+21252; }else { sum[colomn]=k-d; } if (sum[colomn]>21252) { sum[colomn]-=21252; } } } colomn++; } for(int j=0;j<colomn;j++) { cout<<"Case "<<j+1<<": 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