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

贴个ac代码,这题真签到

Posted by zpb at 2020-11-19 04:51:08 on Problem 2586
#include<iostream>
using namespace std;
int main() {
	int s, d;
	while (cin >> s >> d) {
		int i, t;
		for (i = 5; i && i * s - (5 - i) * d >= 0; i--);
		if (i > 1 && (t = 2 * s + 2 * (i * s - (5 - i) * d)) > 0)cout << t << endl;
		else if (i == 1 && (t = s - d + 2 * (i * s - (5 - i) * d)) > 0)cout << t << endl;
		else cout << "Deficit\n";
	}
	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