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

where is wrong?

Posted by o1234 at 2006-10-21 12:04:13 on Problem 2017
#include<stdio.h>
main()
{
int s[20],t[20];
int dis=0,num=0,i=1;
t[0]=0;
scanf ("%d",&num);
while(num!=-1);
{
 for(;i<=num;)
 {
  scanf("%d%d",&s[i],&t[i]);
  i++;
 }
 for(;i>=1;)
 {dis+=s[i]*(t[i]-t[i-1]);
 i--;}
 printf ("%d miles",dis);
 scanf("%d",&num);
}
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