?? 2260.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 + -