본문 바로가기
  • Let's study
PS/백준

[C++] 백준 25893: Majestic 10

by 코딩고수이고파 2023. 5. 19.

문제

https://www.acmicpc.net/problem/25893

 

25893번: Majestic 10

The movie “Magnificent 7” has become a western classic. Well, this year we have 10 coaches training the UCF programming teams and once you meet them, you’ll realize why they are called the “Majestic 10”! The number 10 is actually special in many

www.acmicpc.net

 

해결방법

1. 모두 10 미만이면 'zilch' 출력

2. 모두 10 이상이면 'triple-double' 출력

3. 두 개만 10 이상이면 'double-double' 출력

4. 나머지는 'double' 출력

출력할 때 개행을 두 번해야 한 줄 띄워진다.

 

코드

#include<iostream>

using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	int a, b, c;
	while (n--) {
		cin >> a >> b >> c;

		cout << a << ' ' << b << ' ' << c << '\n';

		if (a < 10 && b < 10 && c < 10)
			cout << "zilch\n\n";
		else if (a >= 10 && b >= 10 && c >= 10)
			cout << "triple-double\n\n";
		else if ((a >= 10 && b >= 10) || (b >= 10 && c >= 10) || (a >= 10 && c >= 10))
			cout << "double-double\n\n";
		else
			cout << "double\n\n";
	}

	return 0;
}

댓글