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

推出来了,呵呵。。。sx[i]表示在连续五个月中盈利的月数为i时,12个月中做多能盈利的月数。。。当然不能连续五个月都盈利,不然8次报表中就会有不是亏损的情况。

Posted by afafafa at 2010-01-01 13:46:50 on Problem 2586
#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:
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