Selecting Subjects (AOJ 0619) by ynu_e
Contest: 3421    RunID: 2277267    Status: Wrong Answer    Date: Sun Apr 23 17:19:28 JST 2017


#include<iostream>

using namespace std;

int which_one(int grade[], int num1, int num2)
{
	int least = 0;

	for (int i = num1; num2>i; i++)
	{
		if (grade[num1]>grade[num1 + 1])
			least = grade[num1 + 1];
		else
			least = grade[num1];
	}

	return least;
}

int main(void)
{
	int grade[6];
	int score = 0;

	for (int i = 0; i<6; i++)
	{
		cin >> grade[i];
		score += grade[i];
	}

	score -= which_one(grade, 0, 3);
	score -= which_one(grade, 4, 5);

	cout << score << endl;

	return 0;
}