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 |
pass#include <iostream> using namespace std; int main() { int arr[100]; int sum=0; int bar[100]={0}; int n; while(cin>>n&&n!=-1) { for (int i=0;i<=n-1;++i) cin>>arr[i]>>bar[i+1]; for (int ii=0;ii<=n-1;++ii) sum+=arr[ii]*(bar[ii+1]-bar[ii]); cout<<sum<<" "<<"miles"<<endl; sum=0; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator