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 jiachunguang at 2010-06-03 15:26:42 on Problem 2393
#include<iostream>
using namespace std;
const int N = 10003;
int main()
{
	__int64 asn=0,min;
	int n,s,i;
	int c[N],y[N];
	cin>>n>>s;
	for( i=0;i<n;i++)
	{
		cin>>c[i]>>y[i];
	}
	for(i=1;i<n;i++)
	{
		min=0;
		if(c[i-1]+s<c[i])
			min=(c[i-1]+s)*y[i];
		else min = c[i]*y[i];
		asn+=min;
	}
	printf("%I64d\n",asn+c[0]*y[0]);
	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