반응형
https://www.acmicpc.net/problem/17009
17009번: Winning Score
The output will be a single character. If the Apples scored more points than the Bananas, output 'A'. If the Bananas scored more points than the Apples, output 'B'. Otherwise, output 'T', to indicate a tie.
www.acmicpc.net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> using namespace std; int main() { int n; int a =0 , b = 0; for (int i = 3; i > 0; i--) { cin >> n; a += n * i; } for (int i = 3; i > 0; i--) { cin >> n; b += n * i; } if (a > b) cout << 'A' << '\n'; else if (a < b) cout << 'B' << '\n'; else cout << 'T' << '\n'; } | cs |
'Algorithm' 카테고리의 다른 글
(C++) - 백준(BOJ) 13866번 : 팀 나누기 (0) | 2019.11.19 |
---|---|
(C++) - 백준(BOJ) 15802번 : 타노스 답 (0) | 2019.11.19 |
(C++) - 백준(BOJ) 14681번 : Quadrant Selection (0) | 2019.11.18 |
(C++) - 백준(BOJ) 16486번 : 운동장 한 바퀴 (0) | 2019.11.18 |
(C++) - 백준(BOJ) 16431번 : 베시와 데이지 (0) | 2019.11.18 |