본문 바로가기
Algorithm

[구현/수학] 백준 6840 Who is in the middle? - 파이썬(Python)

by jangThang 2023. 6. 1.
반응형

백준 온라인 저지

 

[ Contents ]

     

     

    1. 문제 (링크 참조)

     

    6840번: Who is in the middle?

    In the story Goldilocks and the Three Bears, each bear had a bowl of porridge to eat while sitting at his/her favourite chair. What the story didn’t tell us is that Goldilocks moved the bowls around on the table, so the bowls were not at the right seats

    www.acmicpc.net

     

     

    2. 문제 풀이

     세 수를 입력받아 중간값을 구하는 문제입니다.

     

     

    3. 코드

    import sys
    import math
    input = sys.stdin.readline
    
    # 입력
    lst = []
    lst.append(int(input()))
    lst.append(int(input()))
    lst.append(int(input()))
    
    print(sorted(lst)[1])

     

     

    star가 되고나서 Tistory

    반응형

    댓글