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> #include <vector> using namespace std; int main() { int n[4]; vector<int> vn[4]; while(cin>>n[0]>>n[1]>>n[2]>>n[3]) { if(n[0]==-1&& n[1]==-1&& n[2]==-1&& n[3]==-1) break; for(int i(0); i<4; ++i) vn[i].push_back(n[i]); } for(size_t i(0); i<vn[0].size(); ++i) { int d = max(max(vn[0][i],vn[1][i]),vn[2][i]); if(d == vn[0][i]) { while((d-vn[1][i])%28 !=0 ||(d-vn[2][i])%33 !=0) d+=23; } else if(d == vn[1][i]) { while((d-vn[0][i])%23 !=0 ||(d-vn[2][i])%33 !=0) d+=28; } else { while((d-vn[0][i])%23 !=0 ||(d-vn[1][i])%28 !=0) d+=33; } if(d<=vn[3][i]) d=23*28*33-vn[3][i]; else d= (d-vn[3][i]-1)%21252+1; cout <<"Case "<<i+1<<": the next triple peak occurs in "<<d<<" days.\n"; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator