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

Re:为什么有Output Limit Exceed 请各位高手看看

Posted by pgd at 2005-08-07 21:41:35 on Problem 2017
In Reply To:为什么有Output Limit Exceed 请各位高手看看 Posted by:tcxgsy at 2005-08-07 18:56:07
> #define M 1024
> #include"stdio.h"
> #include"math.h"
> main()
> {
>   int n,i;
>   int b;
>   int a[M][2];
>    a[0][1]=0;
>    while(n!=-1)
>     {  scanf("%d",&n);
>        b=0;
>        for(i=1;i<=n;i++)
>             scanf("%d%d",&a[i][0],&a[i][1]);
>      for(i=n;i>0;i--)
>           {  b+=a[i][0]*(a[i][1]-a[i-1][1]);}
>      printf("%d miles\n",b);
>     }
> }
> 
我觉得原因有两个:
1、是n没有赋初值 2、scanf读入两个数据时没有空格 

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