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:结果什么的都对,为什么Wrong anwer!In Reply To:结果什么的都对,为什么Wrong anwer! Posted by:20124233 at 2014-05-11 19:48:46 > #include<iostream> > #include<iomanip> > using namespace std; > int a[12],t[20]; > int main(){ > int m,dex,m1,m2,sum1,sum2; > char p; > while(cin>>m){ > if(m==0)break; > for(int i=2;i<=9;i++)a[i]=m*4; > a[10]=m*16;a[11]=4*m; > sum2=m*52-3; > for(int i=0;i<3;i++){ > cin>>p; > if(p=='K'||p=='Q'||p=='J'||p=='T')t[i]=10; > else if(p=='A')t[i]=11; > else t[i]=p-48; > a[t[i]]--; > } > m1=t[0]; > m2=t[1]+t[2]; > sum1=0; > for(int i=2;i<12;i++){ > m1=t[0]+i; > if(m1>21)m1-=10; > else if(m1<m2)sum1+=a[i]; > } > cout<<fixed<<setprecision(3)<<100.0*sum1/sum2<<'%'<<endl<<endl; > } > return 0; > } 慎用setprecision!你试一下答案为洞的时候输出格式对不对! Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator