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:哪里出问题了,帮帮忙呀,我实在是找不出来啦!!!!!In Reply To:哪里出问题了,帮帮忙呀,我实在是找不出来啦!!!!! Posted by:00430030 at 2005-01-10 16:20:37 #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=a[0]*b[0]; for(j=1;j<n;j++) sum=sum+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