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.
Example
The minimum sum is and the maximum sum is . The function prints
16 24
Function Description
Complete the miniMaxSum function in the editor below.
miniMaxSum has the following parameter(s):
- arr: an array of integers
Print two space-separated integers on one line: the minimum sum and the maximum sum of of elements.
Input Format
A single line of five space-separated integers.
Constraints
Output Format
Print two space-separated long integers denoting the respective minimum and maximum values that can be calculated by summing exactly four of the five integers. (The output can be greater than a 32 bit integer.)
Sample Input
1 2 3 4 5
Sample Output
10 14
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the miniMaxSum function below.
def miniMaxSum(arr):
if __name__ == '__main__':
arr = list(map(int, input().rstrip().split()))
miniMaxSum(arr)
'Engineering WIKI > HackerRank' 카테고리의 다른 글
Time Conversion (0) | 2021.01.17 |
---|---|
Birthday Cake Candles (0) | 2021.01.17 |
Staircase (0) | 2021.01.17 |
Plus Minus (0) | 2021.01.17 |
Diagonal Difference (0) | 2021.01.17 |
A Very Big Sum (0) | 2021.01.17 |
Compare the Triplets (0) | 2021.01.17 |
Simple Array Sum (0) | 2021.01.17 |