https://www.acmicpc.net/problem/17009
17009번: Winning Score
The first three lines of input describe the scoring of the Apples, and the next three lines of input describe the scoring of the Bananas. For each team, the first line contains the number of successful 3-point shots, the second line contains the number of
www.acmicpc.net
농구 경기에서 모든 득점 활동을 기록합니다. 3점슛, 2점 필드골, 1점 자유투로 득점한다.
사과와 바나나라는 두 팀의 각 유형의 득점 횟수를 알고 있다.
어느 팀이 이겼는지 또는 게임이 동점으로 끝났는지 결정해라.
#include <stdio.h>
int main(){
int arr[5], A = 0, B = 0; //사과 팀 A, 바나나 팀 B
for (int i = 0; i < 6; i++)
scanf("%d", &arr[i]); //입력 값을 배열로 받기
A = arr[0]*3 + arr[1]*2 + arr[2]; //순서대로 3, 2, 1 곱하기
B = arr[3]*3 + arr[4]*2 + arr[5]; //순서대로 3, 2, 1 곱하기
if (A == B) //비겼으면
printf("T"); //T 출력
else if (A > B) //사과 팀이 이기면
printf("A"); //A 출력
else //바나나 팀이 이기면
printf("B"); //B 출력
return 0; //종료
}
'Algorithm > 백준' 카테고리의 다른 글
[Algorithm][C언어] 백준 3584번: 가장 가까운 공통 조상 (0) | 2022.10.03 |
---|---|
[Algorithm][C언어] 백준 2033번: 반올림 (0) | 2022.09.27 |
[Algorithm][파이썬] 백준 2609번: 최대공약수와 최소공배수 (0) | 2022.09.19 |
[Algorithm][파이썬] 백준 5598번: 카이사르 암호 (1) | 2022.09.19 |
[Algorithm][JAVA] 백준 3085번: 사탕 게임 (0) | 2022.09.12 |