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"iostream" using namespace std; struct race { char name[50],c; __int64 dist; }; int main() { struct race a[100]; int i=0,flag=1,sum; while(flag) { sum=0; while(1) { scanf("%s",a[i].name); if('a[i].name[0]'=='#') break; else if('a[i].name[0]'!='0') { { scanf("%I64d",&a[i].dist); scanf("%c",&a[i].c); } switch(a[i].c) { case 'F':sum+=2*a[i].dist;break; case 'B':sum+=a[i].dist+0.5*(a[i].dist+1);break; case 'Y': if(a[i].dist<=500) sum+=500; else sum+=a[i].dist; break; default:break; } i++; } else if('a[i].name[0]'=='0') break; } if('a[i-1].name[0]'=='#') break; else if('a[i-1].name[0]'=='0') { printf("%I64d\n",sum); flag=0; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator