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" void main() { int s[11],t[11],l; int n,i; while(1) { l=0; scanf("%d",&n); if(n==-1)break; for(i=0;i<n;i++) { scanf("%d%d",&s[i],&t[i]); } for(i=0;i<n;i++) { if(i==0)l+=s[i]*t[i]; else l+=s[i]*(t[i]-t[i-1]); } printf("%d miles\n",l); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator