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

kill water,simple

Posted by a2659633 at 2011-11-19 01:27:48 on Problem 2017
#include<stdio.h>
int main()
{
	int n,i,s[15],t[15],sum,start;
	while(1)
	{
		scanf("%d",&n);
		if(n==-1) break;
		for(i=0;i<n;i++)
			scanf("%d%d",s+i,t+i);
		start=0;sum=0;
		for(i=0;i<n;i++)
		{
			sum+=s[i]*(t[i]-start);
			start=t[i];
		}
		printf("%d miles\n",sum);
	}
	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