๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm/๋ฐฑ์ค€(BOJ)

[ ํŒŒ์ด์ฌ(python) ] ๋ฐฑ์ค€ 3047 - ABC

by YWTechIT 2021. 6. 7.
728x90

๐Ÿ“ ๋ฐฑ์ค€ 3047 - ABC

๋ฐฑ์ค€ 3047 - ABC


โšก๏ธ ๋‚˜์˜ ํ’€์ด

๋ฌธ์ œ ๋”ฐ๋ผ ๋Œ€์†Œ๊ด€๊ณ„๋ฅผ ๋น„๊ตํ•˜๋ฉด C > B > A๊ฐ€ ๋œ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์ž…๋ ฅ์—์„œ ์ฃผ์–ด์ง„ ์ˆœ์„œ๋Œ€๋กœ ์ถœ๋ ฅํ•ด์•ผํ•˜๋ฏ€๋กœ ๋ฐ˜๋ณต๋ฌธ + ์กฐ๊ฑด๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ถœ๋ ฅํ–ˆ๋‹ค.

 

# ๋‚˜์˜ ์ฝ”๋“œ
arr = list(map(int, input().split()))
arr.sort()
A, B, C = arr

for i in input():
    if i == 'A':
        print(A, end=' ')
    elif i == 'B':
        print(B, end=' ')
    else:
        print(C, end=' ')

# ๋‚˜์˜ ๋‹ค๋ฅธ ์ฝ”๋“œ
arr = list(map(int, input().split()))
A = min(arr)
C = max(arr)
arr.remove(A)
arr.remove(C)
B = int(*arr)

for i in input():
    if i == 'A':
        print(A, end=' ')
    elif i == 'B':
        print(B, end=' ')
    else:
        print(C, end=' ')
๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€