728x90
4435번: 중간계 전쟁
첫째 줄에 전투의 개수 T가 주어진다. 각 전투는 두 줄로 이루어져 있다. 첫째 줄에 간달프 군대에 참여한 종족의 수가 주어진다. 이 값은 공백으로 구분되어 있으며, 호빗, 인간, 엘프, 드워프,
www.acmicpc.net
문제 풀이
문제의 조건에 맞게 각 팀의 점수 합을 구해준 뒤, 출력해준다.
정답 코드
for i in range(1, int(input()) + 1) :
G = list(map(int, input().split()))
S = list(map(int, input().split()))
G_score = G[0] + G[1] * 2 + (G[2] + G[3]) * 3 + G[4] * 4 + G[5] * 10
S_score = S[0] + (S[1] + S[2] + S[3]) * 2 + S[4] * 3 + S[5] * 5 + S[6] * 10
if G_score > S_score : print("Battle {:d}: Good triumphs over Evil".format(i))
elif G_score < S_score : print("Battle {:d}: Evil eradicates all trace of Good".format(i))
else : print("Battle {:d}: No victor on this battle field".format(i))
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 4562 - No Brainer [python] (0) | 2023.03.10 |
---|---|
[프로그래머스] 이진 변환 반복하기 [python] (0) | 2023.03.10 |
[BOJ/백준] 4084 - Viva la Diferencia [python] (0) | 2023.03.08 |
[BOJ/백준] 3578 - Holes [python] (0) | 2023.03.08 |
[BOJ/백준] 3533 - Explicit Formula [python] (0) | 2023.03.07 |