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 |
老大们 。。。看看是什么问题啊 在POJ WA 在ZOJ SIGSEGV。。。实在没办法拉 。。测试数据都可以过的#include <stdio.h> char a[10000],b1[10000],b2[10000]; int count ,i; int value(char c){ if(c=='A')return 11; else if(c=='K'||c=='Q'||c=='J'||c=='T')return 10; else return (int)(c-'0'); } int faceupin(int k){ int value(char c); int x=0; if(value(a[i])<k)x++; if(value(b1[i])<k)x++; if(value(b2[i])<k)x++; return x; } int main(){ int deck[10000],hisvalue,myvalue,leave,small,total; double ans; scanf("%d",&deck[count]); while(deck[count]!=0){ scanf(" %c %c %c",&a[count],&b1[count],&b2[count]); count++; scanf("%d",&deck[count]); } for(i=0;i<count;i++){ hisvalue=value(a[i]); myvalue=value(b1[i])+value(b2[i]); leave=myvalue-hisvalue; total=deck[i]*52-3; if(leave>11)small=total; else if(leave==11) small=12*deck[i]*4-faceupin(11); else small=(leave-1-1)*deck[i]*4-faceupin(leave); ans=small*100.0/total; printf("%.3f%%\n\n",ans); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator