2023년 12월 28일
https://www.acmicpc.net/problem/1233
1233번: 주사위
지민이는 주사위 던지기 게임을 좋아하여 어느 날 옆에 있는 동호를 설득하여 주사위 던지기 게임을 하자고 하였다. 총 3개의 주사위가 있다. 그리고 이 주사위는 각각 S1(2 ≤ S1 ≤ 20), S2(2 ≤ S2
www.acmicpc.net

내 풀이
31120kb 64mb
s1,s2,s3 = map(int,input().split())
dice_list = []
for i in range(1,s1+1):
for j in range(1, s2+1):
for k in range(1,s3+1):
dice_list.append(i+j+k)
max_count = 0
max_num = dice_list[-1]
num_list = list(set(dice_list))
num_list.reverse()
for num in num_list:
if dice_list.count(num) >= max_count:
max_count = dice_list.count(num)
if num < max_num:
max_num = num
print(max_num)'파이썬 알고리즘 연습' 카테고리의 다른 글
| [백준 1333번] 부재중 전화 (0) | 2024.01.16 |
|---|---|
| [백준 1297번] TV 크기 (0) | 2024.01.16 |
| [백준 1212번] 8진수 2진수 (0) | 2024.01.16 |
| [백준 1173번] 운동 (0) | 2024.01.16 |
| [백준 1159번] 농구경기 (0) | 2024.01.16 |