-Code
while True:
n = int(input())
if n == 0:
break
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
res_a, res_b = 0, 0
for i in range(n):
if abs(a_list[i] - b_list[i]) == 1:
if a_list[i] < b_list[i]:
if b_list[i] == 2:
res_a += 6
else:
res_a += a_list[i] + b_list[i]
else:
if a_list[i] == 2:
res_b += 6
else:
res_b += a_list[i] + b_list[i]
elif a_list[i] > b_list[i]:
res_a += a_list[i]
elif a_list[i] < b_list[i]:
res_b += b_list[i]
print(f"A has {res_a} points. B has {res_b} points.\n")
'Beakjoon&프로그래머스 > 파이썬' 카테고리의 다른 글
[백준/파이썬] 13456번 Richard Hamming (1) | 2024.06.15 |
---|---|
[백준/파이썬] 25374번 등급 계산하기 (1) | 2024.06.14 |
[백준/파이썬] 1269번 대칭 차집합 (0) | 2024.06.12 |
[백준/파이썬] 26676번 Wybór zadań (0) | 2024.06.11 |
[백준/파이썬] 31663번 Mean Words (0) | 2024.06.10 |