Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<bits/stdc++.h>
using namespace std;
int a, b, c, d;
int main(){
//Primeiro, lemos a entrada
scanf("%d", &a);
scanf("%d", &b);
scanf("%d", &c);
scanf("%d", &d);
//Então, testamos cada configuração possível.
int ans = abs((a+b)-(c+d));
ans = min(ans, abs((a+c) - (b+d)));
ans = min(ans, abs((a+d) - (b+c)));
printf("%d\n", ans);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment