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<stdio.h> #include<math.h> void main () { int n,a[20],b[20],i,sum=0,j; for(;;) { scanf("%d",&n); if(n==-1) goto end; for(i=0;i<n;i++) scanf("%d %d",&a[i],&b[i]); if(n==1) printf("%d miles\n",a[0]*b[0]); else { sum=0; for(j=1;j<n;j++) sum=sum+a[0]*b[0]+a[j]*(b[j]-b[j-1]); printf("%d miles\n",sum); } end:; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator