| ||||||||||
| 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 | |||||||||
推出来了,呵呵。。。sx[i]表示在连续五个月中盈利的月数为i时,12个月中做多能盈利的月数。。。当然不能连续五个月都盈利,不然8次报表中就会有不是亏损的情况。#include <iostream>
using namespace std;
int sx[] = {0,3,6,8,10};
int main() {
int s,d;
while(cin >> s >> d) {
int i;
int max = d*(-12);
for(i=1;i<=4;i++) {
if(s*i<d*(5-i)) {
if(max < (s*sx[i] - d*(12-sx[i])))
max = (s*sx[i] - d*(12-sx[i]));
}
}
if(max>0) {
cout << max << endl;
}
else {
cout << "Deficit" << endl;
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator