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 wzp_moon at 2015-08-14 09:33:28 on Problem 2017
#include <stdio.h>
#include <math.h>

int main(void)
{
	int n,i,total_s;
	int spd[10],time[10];
	while(scanf("%d",&n),n != -1)
	{
		total_s = 0;
		scanf("%d %d",&spd[0],&time[0]);
		total_s = spd[0] * time[0];

		for (i = 1;i < n;i++)
		{
			scanf("%d %d",&spd[i],&time[i]);
			total_s += spd[i] * (time[i] - time[i-1]);
		}
		printf("%d miles\n",total_s);
	}
	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