HzuHtx


私信TA

用户名:hetangxin123

访问量:41192

签 名:

私はいつまでもレムが好きです。

等  级
排  名 29
经  验 14161
参赛次数 10
文章发表 76
年  龄 0
在职情况 学生
学  校 贺州学院
专  业 软件工程

  自我简介:

写不动,根本写不动

#include "iostream"
#include "cstdio"
#include "cstring"
#include "string"
using namespace std;
string a[] = { "A", "2", "3","4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
int main()
{

	int n;
	cin >> n;
	string s[2];
	char c;
	for (int i = 0; i < n; i++)
	{
		cin >> c;
		cin >> s[0] >> s[1];
		int len1 = s[0].size() - 1;
		int len2 = s[1].size() - 1;
		if (s[0][len1] == c&&s[1][len2] != c)
		{
			cout << "YES" << endl;
			continue;
		}
		if (s[1][len2] == c&&s[0][len1] != c)
		{
			cout << "NO" << endl;
			continue;
		}
		string d1, d2;
		int x, y;
		for (int j = 0; j <= len1; j++)
		{
			if (s[0][j] != 'S'&&s[0][j] != 'H'&&s[0][j] != 'D'&&s[0][j] != 'C')
			{
				d1 += s[0][j];
			}
		}
		for (int j = 0; j <= len1; j++)
		{
			if (s[1][j] != 'S'&&s[1][j] != 'H'&&s[1][j] != 'D'&&s[1][j] != 'C')
			{
				d2 += s[1][j];
			}
		}
		for (int j = 0; j < 13; j++)
		{
			if (d1 == a[j])
			{
				x = j;
			}
			if (d2 == a[j])
			{
				y = j;
			}
		}
		if (x > y)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	return 0;
}
 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区