BOJ/Baekjun-15969-python


質問する



に答える

  • Pythonの内蔵関数maxminを用いて点数の差を求めればよい.
  • コード#コード#

    # https://www.acmicpc.net/problem/15969
    # boj, 15969: 행복, python3
    import sys
    
    input = sys.stdin.readline
    
    def solve(scores: list) -> int:
        return max(scores) - min(scores)
    
    if __name__ == '__main__':
        n = int(input())
        scores = list(map(int, input().split()))
    
        print(solve(scores))

    結果



    ソース&ハーブ


    BOJ 15969
    GITHUB