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

汗, 这都不知道算是怎么过的...

Posted by Desertangle at 2010-09-24 22:30:25 on Problem 2393
res[i]前i周总费用.
res[i] = min{c[i], c[i - 1] + 5} * y[i] + res[i - 1];
注意每次比较了c[i], c[i - 1] + 5后要让c[i]为比较小的那个...
        long long res = 0;
	bool flag = true;
	for(int i = 0; i != n; ++i)
	{
		scanf("%d%d", c + i, f + i);
		if(flag)
		{
			res += (*(c + i)) * (*(f + i));
			flag = false;
		}
		else
		{
			if(c[i] > c[i - 1] + s)
				c[i] = c[i - 1] + s;
			res += c[i] * f[i];
		}
	}

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