Skip to content

Instantly share code, notes, and snippets.

@Thiago4532
Created September 4, 2019 12:46
Show Gist options
  • Save Thiago4532/1302d89eb74bb74ded594ccc92217bd4 to your computer and use it in GitHub Desktop.
Save Thiago4532/1302d89eb74bb74ded594ccc92217bd4 to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main() {
int m, a, b;
cin >> m >> a >> b;
int c = m - (a + b); // Terceiro filho
if (a >= b && a >= c) cout << a << "\n"; // A é o maior
else if (b >= a && b >= c) cout << b << "\n"; // B é o maior
else if (c >= a && c >= b) cout << c << "\n"; // C é o maior
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment