| ||||||||||
| 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 | |||||||||
所有测试集都试过了,包括 24 29 34 0,为什么还是WA#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
int a,b,c,d;
vector<int> vi;
while(1)
{
cin >>a>>b>>c>>d;
if(a == -1 && b == -1 && c == -1 && d == -1)
break;
vi.push_back(a);
vi.push_back(b);
vi.push_back(c);
vi.push_back(d);
}
int* result = new int[vi.size()/4];
memset(result,0,sizeof(result));
for(int i=0; i<vi.size(); ++i)
{
a=vi[i];
b=vi[++i];
c=vi[++i];
d=vi[++i];
for(int k = 0; k < 924; k++)
{
if((23*k+b-a)%28==0&&(23*k+c-a)%33==0)
result[i/4] = (21252 - (23*k-a) -d) % 21252;
if(result[i/4] == 0)
result[i/4] = 21252;
}
}
for(int i = 0; i <vi.size()/4; i++)
{
cout << "Case "<<i+1<<": the next triple peak occurs in "<<result[i]<<" days."<<endl;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator