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<iostream> using namespace std; int b[1000]; int main(){ int m,sum,a; while(cin>>m){ if(m==-1)break; sum=0; for(int i=1;i<=m;i++){ cin>>a>>b[i]; sum+=a*(b[i]-b[i-1]); } cout<<sum<<" miles"<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator