纸牌游戏——巨水

NBUT - 1001

纸牌游戏
Time Limit: 1000MS   Memory Limit: 65535KB   64bit IO Format: %I64d & %I64u

 

Description

玩家1和玩家2各出一张牌,看谁大。如果两张牌都不是王牌花色或则都是王牌花色,则牌面大的牌大,如果牌面一样大则一样大。若其中一张牌是王牌而另一张不是,则无论牌面如何都是王牌花色大。

Input

第一行一个数字n,代表数据组数(n <= 10) 
对于每组数据,首先输入一个字符(S\H\D\C),表示王牌花色。 
接下去一行有两张牌面,表示为牌面花色,如8D、9S等。

Output

对于每组数据,输出第一张牌是否比第二张牌大,若是则输出YES,否则输出NO

Sample Input

1HQH 9S

Sample Output

YES

Source

CodeForces
 
 1 #include<iostream>
 2 #include<algorithm>
 3 #include<queue>
 4 #include<cstdio>
 5 #include<cstdlib>
 6 #include<cstring>
 7 #include<cmath>
 8 using namespace std;
 9 #define sr(x) scanf("%d",&x)
10 #define sc(x) printf("%d",x)
11 #define hh printf("\n")
12 #define mod 2011
13 int main()
14 {
15     int tt;
16     cin>>tt;
17  while(tt--)
18  {
19   char a,b,c,x,y;
20   cin>>c;
21   cin>>x>>a>>y>>b;
22   if(a==c&&b==c)
23   {
24    if(x>y)cout<<"YES"<<endl;
25    else cout<<"NO"<<endl;
26   }
27   else if(a==c&&b!=c)cout<<"YES"<<endl;
28   else if(a!=c&&b==c)cout<<"NO"<<endl;
29   else
30   {
31    if(x>y)cout<<"YES"<<endl;
32    else cout<<"NO"<<endl;
33   }
34  } 
35     return 0;
36 } 

 

posted on 2013-11-07 23:43  lveternal  阅读(205)  评论(0编辑  收藏  举报

导航