본문 바로가기
Algorithm

[구현/수학] 백준 11367 Reprot Card Time - 파이썬(Python)

by jangThang 2023. 3. 26.
반응형

백준 온라인 저지

 

[ Contents ]

     

     

    1. 문제 (링크 참조)

     

    11367번: Report Card Time

    The input will begin with a single line containing just a whole number, n, of the number of hobbits in the class, followed by n lines in the form a b, where a is the hobbit’s name (only alphabetical characters) and b is the hobbit’s grade, given as a w

    www.acmicpc.net

     

     

    2. 문제 풀이

     평점평균을 계산하는 문제입니다.

     

     

    3. 코드

    import sys
    input = sys.stdin.readline
    
    # 입력
    for _ in range(int(input())):
        s, n = input().rstrip().split()
        n = int(n)
        if n >= 97: res = "A+"
        elif n >= 90: res = "A"
        elif n >= 87: res = "B+"
        elif n >= 80: res = "B"
        elif n >= 77: res = "C+"
        elif n >= 70: res = "C"
        elif n >= 67: res = "D+"
        elif n >= 60: res = "D"
        else: res = "F"
        print(s, res)

     

     

    star가 되고나서 Tistory

    반응형

    댓글