문제
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;
}
'PS > 백준' 카테고리의 다른 글
[C++] 백준 25881: Electric Bill (0) | 2023.05.21 |
---|---|
[C++] 백준 9772: Quadrants (0) | 2023.05.20 |
[C++] 백준 27880: Gahui and Soongsil University statio (0) | 2023.05.18 |
[C++] 백준 22155: Простая задача (0) | 2023.05.17 |
[C++] 백준 27890: 특별한 작은 분수 (1) | 2023.05.16 |
댓글