less than 1 minute read

Mini-Max Sum (Hacker Rank)

Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers.

#!/bin/python3

import sys

arr = list(map(int, input().strip().split(' ')))

result = []
for a in arr:
    result.append(sum(arr)-a)

min = min(result)
max = max(result)

print(min, max)
행운의 77문제 프로젝트
  행운의 77문제 프로젝트는 한 달동안 알고리즘 문제 77개를 푸는 프로젝트입니다.