poj2017

一天两个题,凑数用的大水题啊。。。不解释了。。羞愧ing

 1 #include <stdio.h>
 2 int main(){
 3     int t;
 4     int i;
 5     int a[100],b[100],tot;
 6     while(~scanf("%d",&t)&&t!=-1){
 7         tot=0;
 8         for(i=0;i<t;++i){
 9             scanf("%d%d",&a[i],&b[i]);
10             if(i==0)
11                 tot+=a[i]*b[i];
12             else
13                 tot+=a[i]*(b[i]-b[i-1]);
14         }
15         printf("%d miles
",tot);
16     }
17     return 0;
18 }
原文地址:https://www.cnblogs.com/symons1992/p/3519965.html