20分帮忙!!!
查看原帖
20分帮忙!!!
1069285
Sutong123楼主2024/10/28 20:39
#include <bits/stdc++.h>
using namespace std;
int n;
bool s[5][53];
int sum;
int main (){
	cin >> n;
	memset(s, false, sizeof(s));
	for (int i = 1; i <= n; i++) {
		char x, y;
		int a, b;
		cin >> y >> x;
		if (y = 'D')
			a = 1;
		else
			if (y == 'C')
				a = 2;
			else
				if (y == 'H')
					a = 3;
				else
					if (y == 'S')
						a = 4;
		if (x >= 50 && x <= 57)
			b = x - '0';
		else
			if (x == 'A')
				b = 1;
		    else
				if (x == 'T')
					b = 10;
				else
					if (x == 'J')
						b = 11;
					else
						if (x == 'Q')
							b = 12;
						else
							if (x == 'K')
								b = 13;
		if (s[a][b] == false) {
			sum++;
			s[a][b] = true;
		}
	}
	cout << 52 - sum;
	return 0;
}

帮忙看一下哪里出了问题,谢谢。

2024/10/28 20:39
加载中...