⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2260.cpp

📁 哈尔滨工业大学ACM 竞赛网上在线试题集锦的源代码
💻 CPP
字号:
/*  This Code is Submitted by wywcgs for Problem 2260 on 2006-05-29 at 10:26:45 */ 
#include <cstdio>
#include <cstring>

const int HV[] = { 50, 100, 100, 0, 0, 0, 10, 10, 10, 10, 10, 10, 20, 30, 40, 50 };
const char CARD[][4] = { "10C", "QS", "JD", "2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", 
								"10H", "JH", "QH", "KH", "AH" };

int main()
{
	int t, T, i, n;

	scanf("%d", &T);
	for(t = 0; t < T; t++) {
		scanf("%d", &n);
		bool get[2] = { false, false };
		int score = 0, hs = 0, hn = 0;
		for(i = 0; i < n; i++) {
			int o; char card[4]; scanf("%s", card);
			for(o = 0; strcmp(card, CARD[o]); o++);
			switch(o) {
			case 0: case 1: get[o] = true; break;
			case 2: score += HV[o]; break;
			default: hs += HV[o]; hn++; break;
			}
		}
		if(n == 1 && get[0]) score = HV[0];
		else {
			score += ((hn==13)?1:-1) * hs;
			if(get[1]) score += ((n==16)?1:-1) * HV[1];
			if(get[0]) score *= 2;
		}
		printf("%d\n", score);
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -