| ||||||||||
| 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:Re:提交了20多次再加上和同学AC的代码比较终于知道陷阱在哪儿了.估计WA的都是这样. Posted by:liymouse at 2005-09-06 19:09:05 > 果真是这样!
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "string.h"
void main()
{
int m=0,dis,k=0;
char or[100],di[100],code,ch;
scanf("%s%s",or,di);
while(strcmp(or,"0")!=0&&di[0]!='#')
{
scanf("%d%c%c",&dis,&ch,&code);
switch(code)
{
case 'F':m=m+dis*2;break;
case 'B':m=m+dis+(dis+1)/2;break;
case 'Y':
if(dis<500)m=m+500;
else
m=m+dis;break;
}
scanf("%s%s",or,di);
}
printf("%d\n",m);
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator