Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

编译器正确,提交显示错误

Posted by jdshixf at 2009-04-25 00:47:19 on Problem 2017
用动态数组做的,提交总是失败。汗。。。。。
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator