홍우진의 개발 일기장
[백준] 2303번: 숫자 게임 / 파이썬 본문
728x90
반응형
문제 링크
https://www.acmicpc.net/problem/2303
풀이 코드
n = int(input())
score = []
for _ in range(n):
card = list(map(int,input().split()))
top = 0
for i in range(5):
for j in range(i + 1, 5):
for m in range(j + 1, 5):
dap = (card[i] + card[j] + card[m])%10
if dap >= top:
top = dap
score.append(top)
for i in range(n - 1, -1, -1):
if score[i] == max(score):
print(i + 1)
break
코드 해석
브루트포스와 삼중 for문을 써서 구한다.
번호가 큰 사람순으로 출력한다.
체감 난이도: ★★☆☆☆
728x90
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 25757번: 임스와 함께하는 미니게임 / 파이썬 (0) | 2025.03.08 |
---|---|
[백준] 1057번: 토너먼트 / 파이썬 (0) | 2025.03.07 |
[백준] 1620번: 나는야 포켓몬 마스터 이다솜 / 파이썬 (0) | 2025.03.05 |
[백준] 1406번: 에디터 / 파이썬 (0) | 2025.03.04 |
[백준] 15655번: N과 M (6) / 파이썬 (0) | 2025.03.03 |
Comments