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

pass

Posted by niuniu2006 at 2007-04-03 21:09:23 on Problem 2017
#include <iostream>
using namespace std;

int main()
{
		int arr[100];
		int sum=0;
		int bar[100]={0};
		int n;
	while(cin>>n&&n!=-1)
	{	for (int i=0;i<=n-1;++i)
			cin>>arr[i]>>bar[i+1];
		for (int ii=0;ii<=n-1;++ii)
			sum+=arr[ii]*(bar[ii+1]-bar[ii]);
		cout<<sum<<" "<<"miles"<<endl;
		sum=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