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 main() { int n,i,sum; cin>>n; int *speed=new int[n]; int *time=new int[n]; for(i=0;i<n;i++) { cin>>speed[i]; cin>>time[i]; } sum=time[0]*speed[0]; for(i=0;i<n-1;i++) sum+=(time[i+1]-time[i])*speed[i+1]; cout<<sum<<" miles"<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator