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; #define NUM 1000 int main() { int p,e,i,d,k=0,num[NUM],n=0; cin>>p>>e>>i>>d; while(!(p==-1&&e==-1&&i==-1&&d==-1)) { if(p>365||e>365||i>365||d>365) return 0; k=d+1; for(;k<=21252;k++) { if(((k-p)%23)==0&&((k-e)%28)==0&&((k-i)%33)==0) break; } num[n++]=k-d; cin>>p>>e>>i>>d; k=0; } for(int j=0;j<n;j++) { if(num[j]<=0) num[j]+=21252; cout<<"Case "<<j+1<<": the next triple peak occurs in "<<num[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