Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

所有测试集都试过了,包括 24 29 34 0,为什么还是WA

Posted by winshare at 2008-04-08 10:32:55 on Problem 1006
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator