| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
kill water,simple#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator