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 |
Re:为什么有Output Limit Exceed 请各位高手看看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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator