| ||||||||||
| 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 | |||||||||
贴个ac代码,这题真签到#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator