| ||||||||||
| 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 | |||||||||
太水,倒数第二水。。。贴代码#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator