SWLUG/๋ฐฑ์ค€ BEAKJOON

[python/ํŒŒ์ด์ฌ] ๋ฐฑ์ค€ BEAKJOON 2476๋ฒˆ: ์ฃผ์‚ฌ์œ„ ๊ฒŒ์ž„

waterproof 2023. 5. 22. 19:11

[python/ํŒŒ์ด์ฌ] ๋ฐฑ์ค€ BEAKJOON 2476๋ฒˆ: ์ฃผ์‚ฌ์œ„ ๊ฒŒ์ž„

https://www.acmicpc.net/problem/2476

 

2476๋ฒˆ: ์ฃผ์‚ฌ์œ„ ๊ฒŒ์ž„

์ฒซ์งธ ์ค„์—๋Š” ์ฐธ์—ฌํ•˜๋Š” ์‚ฌ๋žŒ ์ˆ˜ N์ด ์ฃผ์–ด์ง€๊ณ  ๊ทธ ๋‹ค์Œ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์— ์‚ฌ๋žŒ๋“ค์ด ์ฃผ์‚ฌ์œ„๋ฅผ ๋˜์ง„ 3๊ฐœ์˜ ๋ˆˆ์ด ๋นˆ์นธ์„ ์‚ฌ์ด์— ๋‘๊ณ  ๊ฐ๊ฐ ์ฃผ์–ด์ง„๋‹ค. 

www.acmicpc.net

 

 

 

1) ๋ฌธ์ œ

 

2) ์‹œํ–‰ ์ฐฉ์˜ค

 

 

    a) 1์ฐจ ์‹œ๋„

n=int(input())

for i in range(1,n+1):
    a,b,c=map(int, input().split())

if a==b==c:
    print(int(10000+(a*1000)))

elif a==b and a!=c:
    print(int(1000+(a*100)))

elif b==c and b!=a:
    print(int(1000+(b*100)))

elif a==c and a!=b:
    print(int(1000+(a*100)))

elif a>b>c:
    print(int(a*100))

elif a>c>b:
    print(int(a*100))

elif b>a>c:
    print(int(b*100))

elif b>c>a:
    print(int(a*100))

elif c>a>b:
    print(int(c*100))

elif c>b>a:
    print(int(c*100))

   

    b) 1์ฐจ ์‹œ๋„ - ํ‹€๋ฆฐ ์ด์œ 

๋‚ด ์ฝ”๋“œ์˜ ์ถœ๋ ฅ๊ฐ’: ๋ฌด์กฐ๊ฑด ์ž…๋ ฅ๊ฐ’์˜ ๋งˆ์ง€๋ง‰ ์ค„์„ ๊ณ„์‚ฐํ•œ ๊ฐ’์ด ์ถœ๋ ฅ๊ฐ’์ด ๋œ๋‹ค.

์ •๋‹ต์˜ ์ถœ๋ ฅ๊ฐ’: ๊ฐ ์ค„์„ ๊ณ„์‚ฐํ•œ ๊ฒฐ๊ด๊ฐ’์„ ๋น„๊ตํ•ด์„œ ๊ทธ ์ค‘ ๊ฐ€์žฅ ํฐ ๊ฐ’์ด ์ถœ๋ ฅ๊ฐ’์ด ๋˜์–ด์•ผ ํ•จ

-

๊ทธ๋ ‡๋‹ค๋ฉด ๊ฐ ์ค„์„ ๋”ฐ๋กœ๋”ฐ๋กœ ๊ณ„์‚ฐํ•œ ๋’ค ๋น„๊ตํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

์–ด์ฉŒ๋‹ค๊ฐ€ ๋‚ด๊ฐ€ ์ „์— ํ’€์—ˆ๋˜ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ๋ฅผ ๋ดค๋Š”๋ฐ list ์™€ max ๋ฅผ ์‚ฌ์šฉํ•œ ๊ฒƒ์„ ๋ณด์•˜๋‹ค.

'์ตœ๋Œ“๊ฐ’' ์„ ๊ตฌํ•ด์•ผ ํ•˜๋ฏ€๋กœ list์™€ max๋ฅผ ์ด์šฉํ•˜๋Š” ๊ฒƒ๋„ ๋ฐฉ๋ฒ•์ด ๋  ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™๋‹ค.

๊ทธ๋Ÿฐ๋ฐ ์–ด๋–ป๊ฒŒ ์ฝ”๋“œ๋กœ ๊ตฌํ˜„ํ•ด์•ผ ํ•˜๋Š” ์ง€๊ฐ€ ๋ง‰๋ง‰ํ–ˆ๋‹ค.

 

 

    c) 2์ฐจ ์‹œ๋„

result=0
maximum=0
n=int(input())
for i in range(n):
    a, b, c=map(int, input().split())    
    if a==b==c:
        result=int(10000+(a*1000))
    elif a==b and a!=c:
        result=int(1000+(a*100))
    elif b==c and b!=a:
        result=int(1000+(b*100))
    elif a==c and a!=b:
        result=int(1000+(a*100))
    elif a>b>c:
        result=int(a*100)
    elif a>c>b:
        result=int(a*100)
    elif b>a>c:
        result=int(b*100)
    elif b>c>a:
        result=int(a*100)
    elif c>a>b:
        result=int(c*100)
    else:
        result=int(c*100)
    if maximum<result:
        maximum=result
print(maximum)

    d) 2์ฐจ ์‹œ๋„ - ํ‹€๋ฆฐ ์ด์œ 

์ง„์งœ ๋ชจ๋ฅด๊ฒ ๋‹ค...

์–ด๋Š ๋ถ€๋ถ„์ด ํ‹€๋ฆฐ ๊ฑด์ง€ ์•Œ ์ˆ˜ ์žˆ๋‹ค๋ฉด ์ข‹๊ฒ ๋‹ค...

ํŒŒ์ด์ฌ ๊ณ ์ˆ˜๋ถ„๋“ค ํ˜น์‹œ๋‚˜ ์ด ๊ธ€์„ ๋ณด์‹ ๋‹ค๋ฉด ์ •๋‹ต์„ ๋Œ“๊ธ€๋กœ ์•Œ๋ ค์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

-

์กฐ๊ธˆ์”ฉ ์ˆ˜์ •ํ•ด๋ณด์•˜์œผ๋‚˜ ๊ฒฐ๊ตญ ์œ„์˜ ์ฝ”๋“œ๋ฅผ ๋งˆ์ง€๋ง‰์œผ๋กœ ํฌ๊ธฐ

 

 

3) ๋ฌธ์ œ ํ’€์ด/ ์ •๋‹ต

๊ฒฐ๊ตญ ์ธํ„ฐ๋„ท์— ์˜ฌ๋ผ์™€ ์žˆ๋Š” ๋‹ค๋ฅธ ๋ถ„์˜ ์ฝ”๋“œ๋ฅผ ์ œ์ถœํ–ˆ๋‹ค.

์•„๋งˆ ๋‚ด๊ฐ€ ์ง  ์ฝ”๋“œ๋Š” ์กฐ๊ฑด๋ฌธ ๋ถ€๋ถ„์—์„œ ํ‹€๋ ธ๋‹ค๊ณ  ํ•œ ๊ฒƒ ๊ฐ™์€๋ฐ,  ์—ฌ์ „ํžˆ ์ •ํ™•ํžˆ ์–ด๋Š ๋ถ€๋ถ„์ด ํ‹€๋ ธ๋Š”์ง€ ์ดํ•ด๊ฐ€ ๊ฐ€์ง€ ์•Š๋Š”๋‹ค...

[์ถœ์ฒ˜] [python] BAEKJOON _ 2476๋ฒˆ|์ž‘์„ฑ์ž EllieZzhan

https://blog.naver.com/pcy921118/222551610986

 

[python] BAEKJOON _ 2476๋ฒˆ

์ฃผ์‚ฌ์œ„ ๊ฒŒ์ž„ ์ฐธ์—ฌํ•˜๋Š” ์‚ฌ๋žŒ์˜ ์ˆ˜๋ฅผ case์— ๋‹ด์•„์ฃผ๊ณ , ๊ฒฐ๊ณผ๋ฅผ ๋ฐ›์„ result ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•ด์ค€๋‹ค. ์ฐธ์—ฌํ•˜๋Š” ์‚ฌ...

blog.naver.com

case = int(input())
result = 0

for _ in range(case):
    a, b, c = map(int, input().split())

    if a == b == c:
        result = max(result, 10000+a*1000)
    elif a == b:
        result = max(result, 1000+a*100)
    elif a == c:
        result = max(result, 1000+a*100)
    elif b == c:
        result = max(result, 1000+b*100)
    else:
        result = max(result, 100*max(a, b, c))

print(result)