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

Re:discuss中的用例都测过了,提交总是WA,求大神帮忙看看

Posted by z185665096 at 2018-07-03 20:49:16 on Problem 1006
In Reply To:discuss中的用例都测过了,提交总是WA,求大神帮忙看看 Posted by:2310852380 at 2018-02-24 17:55:21
> #include<iostream>
> #include<vector>
> using namespace std;
> 
> int p = 0, e = 0, i = 0, d = 0;
> int calculate();
> void stdOut(int num, int days);
> 
> int main()
> {
> 	int days = 0, num = 1;
> 	while (cin >> p >> e >> i >> d) {
> 		if ((p == -1) && (e == -1) && (i == -1) && (d == -1)) {
> 			break;
> 		}
> 		days = calculate();
> 		stdOut(num, days-d);
> 		num++;
> 	}
> 	return 0;
> }
> 
> int calculate()
> {
> 	int num = 0;
> 	for (num = d+1; num <= 21252; num++) {
> 		if (((num-p)%23 == 0) && ((num-e)%28 == 0) && ((num-i)%33 == 0) ) {
> 			break;
> 		}
> 	}
> 	return num ;
> }
> 
> void stdOut(int num, int days)
> {
> 	cout << "Case " << num << ": the next triple peak occurs in " << days << " 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