Question: 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

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.

Input Format

A single line of five space-separated integers.

Constraints

Each integer is in the inclusive range .

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 

Explanation

Our initial numbers are , , , , and . We can calculate the following sums using four of the five integers:

If we sum everything except , our sum is .

If we sum everything except , our sum is .

If we sum everything except , our sum is .

If we sum everything except , our sum is .

If we sum everything except , our sum is .

#include

using namespace std;

vector split_string(string);

/* * Complete the miniMaxSum function below. */ void miniMaxSum(vector arr) { /* * Write your code here. */ int a,b,c,d,e;

cin >> a >> b >> c >> d >> e; arr ={a+b+c+d,a+c+d+e,b+c+d+e,a+b+d+e, a+b+c+e}; int min=arr[0]; int max=arr[0];

for (int i=0; i<5;i++){ if (arr[i]>max){ max=arr[i]; } if (arr[i]

} cout<

Your code did not pass this test case.

Compile Message

solution.cc: In function void miniMaxSum(std::vector): solution.cc:37:32: warning: format %d expects argument of type int, but argument 2 has type const char* [-Wformat=] printf("%d", "%d", min, max); ^ solution.cc:37:32: warning: too many arguments for format [-Wformat-extra-args] 

Exit Status

0

Run Time

Input (stdin)

1 2 3 4 5

Your Output (stdout)

20 32612 4202114

Expected Output

10 14

Compiler Message

Wrong Answer

How can I get rid of this error message?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!