Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Archives
Today
Total
관리 메뉴

게임 개발 메모장

16. 카드 게임 본문

문제 해결력 훈련

16. 카드 게임

Dev_Moses 2024. 1. 8. 16:00

 

#include <iostream>

using namespace std;

int main()
{
	int MaxCount = 10;

	int ScoreA = 0;
	int ScoreB = 0;

	int A, B;

	int TeamA[10];
	int TeamB[10];

	for (int i = 0; i < MaxCount; ++i)
	{
		cin >> A;
		TeamA[i] = A;
	}

	for (int i = 0; i < MaxCount; ++i)
	{
		cin >> B;
		TeamB[i] = B;
	}

	for (int i = 0; i < MaxCount; ++i)
	{
		if (TeamA[i] > TeamB[i])
		{
			ScoreA += 3;
		}
		else if (TeamA[i] < TeamB[i])
		{
			ScoreB += 3;
		}
		else
		{
			ScoreA++;
			ScoreB++;
		}
	}

	cout << ScoreA << " " << ScoreB << endl;
	if (ScoreA > ScoreB)
	{
		cout << "A";
	}
	else if (ScoreA < ScoreB)
	{
		cout << "B";
	}
	else
	{
		cout << "D";
	}
}

'문제 해결력 훈련' 카테고리의 다른 글

18. 연속 부분 증가 수열  (0) 2024.01.09
17. 온도의 최대값  (0) 2024.01.09
15. 가위 바위 보  (1) 2024.01.08
14. 분노 유발자  (0) 2024.01.08
13. 층간 소음  (0) 2024.01.08