poj 2062
来源:互联网 发布:花生壳域名ip解析失败 编辑:程序博客网 时间:2024/06/06 20:39
#include<iostream>
#include<queue>
#include<algorithm>
#include<map>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include <iomanip>
#include <stack>
#include <sstream>
////////
using namespacestd;
struct player
{
int no;
int type;
};
player adam[28];
player eve[28];
int getnum(char s[3])
{
int number=0;
if(s[0]>='2' && s[0]<='9')
number = s[0] -'0';
if(s[0]=='T')
number =10;
if(s[0]=='J')
number=11;
if(s[0]=='Q')
number=12;
if(s[0]=='K')
number=13;
if(s[0]=='A')
number=14;
return number;
}
bool cmp(constplayer &a,constplayer &b)
{
if(a.no==b.no)
return a.type<b.type;
else return a.no<b.no;
}
int main()
{
int i,j;
int Cases;
char card[3];
int num_of_cards;
scanf("%d",&Cases);
while (Cases--)
{
scanf("%d",&num_of_cards);
for(i=0;i<num_of_cards;i++)
{
cin>>card;
int num =getnum(card);
adam[i].no = num;
if(card[1]=='C')
num = 1;
if(card[1]=='D')
num =2;
if(card[1]=='S')
num=3;
if(card[1]=='H')
num = 4;
adam[i].type = num;
}
sort(adam,adam+num_of_cards,cmp);
///////////
for(i=0;i<num_of_cards;i++)
{
cin>>card;
int num =getnum(card);
eve[i].no = num;
if(card[1]=='C')
num = 1;
if(card[1]=='D')
num =2;
if(card[1]=='S')
num=3;
if(card[1]=='H')
num = 4;
eve[i].type = num;
}
sort(eve,eve+num_of_cards,cmp);
int Count =0;
int flag =0;
for(i=0;i<num_of_cards;i++)
for(j=flag;j<num_of_cards;j++)
{
if(eve[j].no>adam[i].no || (eve[j].no==adam[i].no &&eve[j].type>adam[i].type))
{
Count++;
flag = j+1 ;
break;
}
}
printf("%d\n",Count);
}
return0;
}
- poj 2062
- POJ 2062 完全背包
- POJ 2062 最大匹配
- POJ
- poj
- POJ
- POJ
- poj
- poj
- POJ
- POJ
- poj
- POJ
- POJ
- POJ
- POJ
- POJ
- POJ
- 快速排序
- linux命令vmstat详解
- java.lang.ClassNotFoundException: org.apache.http.util.Args
- ffmpeg的转码延时测试与设置优化
- Android Studio 配置NDK
- poj 2062
- 73. Set Matrix Zeroes
- BZOJ2277: [Poi2011]Strongbox
- 从0开始学习 GITHUB 系列之「GIT 速成」
- 结汇
- 更改ORACLE归档路径及归档模式
- FFMPEG结构体分析:AVFrame(解码后的数据)
- ☆ Codeforces 724C Ray Tracing 扩展欧几里得 + 计算几何
- poj 2051