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

求助,测过特殊数据了还是WA,谢谢

Posted by crxrxcxcr at 2017-03-11 11:12:37 on Problem 1006
#include<iostream>
#include<string>
#include<iomanip>
#include<ios>
#include<vector>
#include<algorithm>
#define pi 3.1415926;
using namespace std;
int findtp(int pday , int eday , int iday , int date)
{
	int inipday = pday;
	while(1)
	{
		pday += 23;
		if(eday < pday)
			eday += 28;
		if(iday < pday)
			iday += 33;
		if(pday == eday && pday == iday)
			break;
	}
	return pday - date;
}
int main()
{
	int p , i , e , d , count = 0 , x;
	vector<int> peak;
	while(cin >> p && cin >> e && cin >> i && cin >> d)
	{
		if(p == -1 && e == -1 && i == -1 && d == -1)
			break;
		if(findtp(p ,e , i ,d) == 0)
			peak.push_back(21252);
		else if(findtp(p , e, i ,d) > 21252)
			peak.push_back(findtp(p , e , i , d) - 21252);
		else
		    peak.push_back(findtp(p , e , i , d));
		count++;
	}
	for(x = 0;x < count;x++)
		cout << "Case " << x + 1 << ": " << "the next triple peak occurs in " << peak[x] << " days." << endl;
	return 0;
}

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