Official

A - Repression Editorial by en_translator


There are three combinations of cards you pick:

  • the card with \(A\) written on it, and the card with \(B\) written on it,
  • the card with \(B\) written on it, and the card with \(C\) written on it, and
  • the card with \(C\) written on it, and the card with \(A\) written on it.

Therefore, you can output the maximum value of \(A+B\), \(B+C\), and \(C+A\).

Sample code (Python)

A,B,C = map(int,input().split())
print(max(A+B,B+C,C+A))

One may also write as follows.

Sample code (C++)

#include<bits/stdc++.h>
using namespace std;

int main(){
	int A,B,C; cin >> A >> B >> C;
	cout << A+B+C-min({A,B,C}) << endl;
}

posted:
last update: