Skip to content

Instantly share code, notes, and snippets.

@PedroRacchetti
Created September 1, 2021 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PedroRacchetti/dfbca656c11b3996b525e2f0dcb55c6d to your computer and use it in GitHub Desktop.
Save PedroRacchetti/dfbca656c11b3996b525e2f0dcb55c6d to your computer and use it in GitHub Desktop.
#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