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..........

Posted by unm at 2007-10-13 06:42:09 on Problem 2005
In Reply To:rrdw:我这个code WA在哪里?。。。 两个A都考虑的呀。。。或者谁给个code。。 Posted by:unm at 2007-10-12 15:00:02
> 
> 
> #include <iostream>
> #include <cstdio>
> #define left llleft
> #define index iiidex
> using namespace std;
> int getvalue1(char x) {
>   if (x=='K' || x=='Q' || x=='J' || x=='T') return 10;
>   if (x=='A') return 11;
>   return x-'0';
> }
> int getvalue2(char x,char y) {
>   if (x=='A' && y=='A') return 12;
>   else return getvalue1(x)+getvalue1(y);
> }
> int left[100];
> char output[100];
> 
> char list[100];  
> int index[400];
> int main() {
>   char ch1,ch2,ch3;
>   int i,n;
>   list[0]='2';
>   list[1]='3';
>   list[2]='4';
>   list[3]='5';
>   list[4]='6';
>   list[5]='7';
>   list[6]='8';
>   list[7]='9';
>   list[8]='A';
>   list[9]='K';
>   list[10]='Q';
>   list[11]='J';
>   list[12]='T';
>   
>   
>   for (i='2';i<='7';++i) {
>     index[i]=i-'2';
>   }
>   index['A']=8;
>   index['K']=9;
>   index['Q']=10;
>   index['J']=11;
>   index['T']=12;
>   double o;
>   bool first=1;
>   while (1) {
> 
>     scanf("%d",&n);
>     if (n==0) break;
> 
>     if (first) {
>       first=0;
>     }
>     else putchar('\n');
>     for (i=0;i<=12;++i) left[i]=4*n;
>     
>     scanf(" %c %c %c",&ch1,&ch2,&ch3);
>     left[index[ch1]]--;
>     left[index[ch2]]--;
>     left[index[ch3]]--;
>     int my=getvalue2(ch2,ch3);
>     o=0;
>     for (i=0;i<=12;++i) {
>       if (getvalue2(ch1,list[i])<my) {
> 	o+=(double)left[i]*100/(52*n-3);
>       }
>     }
>     
>     sprintf(output,"%.3lf",o);
>     if (strcmp(output,"-0.000")==0) printf("0.000");
>     else printf("%s",output);
>     putchar('%');
>     putchar('\n');
>   }
>   return 0;
> }
> 
> 	
>       
>     
>     
>     
>     
>     
>     

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