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 |
晕!int AC double WA why?!#include "stdio.h" #include "string.h" #include "math.h" double bonus(double real,char * str){ if(!strcmp(str,"F")){ return 2*real; }else if(!strcmp(str,"B")){ return 1.5*real-(int)(1.5*real)>0.1 ? (int)(1.5*real+1) : (int)(1.5*real); }else{ if(real >= 500){ return real; } return 500.0; } } int main(){ #ifndef ONLINE_JUDGE freopen("in","r",stdin); #endif char str1[100],str2[100],cla[2]; double x; while(scanf("%s%s%lf%s",str1,str2,&x,cla), strcmp(str1,"#")){ double sum = 0; sum += bonus(x,cla); while(scanf("%s",str1)){ if(!strcmp(str1,"0")){ printf("%.0lf\n",sum); break; } scanf("%s%lf%s",str2,&x,cla); sum += bonus(x,cla); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator