포스트

[Python] Baekjun number 2480 - three dice

We have summarized the solution for calculating the prize money of three dice using Python conditional statements and max().

한국어 원문은 여기에서 볼 수 있습니다.
[Python] Baekjun number 2480 - three dice

BaekJoon 2480

Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
a, b, c = input().split()
a, b, c = int(a), int(b), int(c)

if (a == b) and (b == c):
    print(10000 + a*1000)
elif (a == b) or (b == c) or (a == c):
    if (a == b): print(1000 + a*100)
    elif (b == c): print(1000 + b*100)
    else: print(1000 + a*100)
else:
    large = 0
    for num in a, b, c:
        if num > large:
            large = num
    print(large * 100)

max() function

  • Used to find the maximum value
  • Can be obtained without using loops
    1
    
    large = max(a, b, c)