Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:结果什么的都对,为什么Wrong anwer!

Posted by KatrineYang at 2016-05-26 21:44:03 on Problem 2005 and last updated at 2016-05-26 21:44:44
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator