#include <stdio.h>
int N;
int card[12];
int sel[52];
int main()
{
int tc = 0;
scanf("%d", &tc);
for (int t = 1; t <= tc; t++)
{
int score = 0;
scanf("%d", &N);
for (int i = 2; i < 12; i++)
card[i] = 4;
card[10] = 16;
for (int i = 0; i < N; i++)
{
scanf("%d", &sel[i]);
score += sel[i];
card[sel[i]]--;
}
int sum_down = 0, sum_up = 0;
for (int i = 2; i < 12; i++) {
if (i <= 21 - score)
sum_down += card[i];
else
sum_up += card[i];
}
if (sum_down <= sum_up)
printf("#%d STOP\n", t);
else
printf("#%d GAZUA\n", t);
}
return 0;
}
1. 배열에 각각 카드 가치에 대한 카드 숫자 저장
2. 뽑은 모든 카드의 가치의 합이 21보다 크게 만드는 카드의 개수 저장
뽑았을 때 가치의 합을 21 이하로 만드는 카드의 개수 저장
3. 끝!!
'공부 > SWEA' 카테고리의 다른 글
SWEA 9839. 최고의 쌍 (C++) (0) | 2024.05.08 |
---|---|
SWEA 11315. 오목 판정 (C++) (0) | 2024.05.08 |
SWEA 3975. 승률 비교하기 (C++) (0) | 2024.05.06 |
SWEA 5986. 새샘이와 세 소수 (C++) (0) | 2024.05.06 |
SWEA 4522. 세상의 모든 팰린드롬 (C++) (0) | 2024.05.06 |