1230A Dawid and Bags of Candies

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int arr[4];
for(int i=0;i<4;i++){
cin>>arr[i];
}
sort(arr,arr+4);
if(arr[0]+arr[3]==arr[1]+arr[2])
cout<<"YES"<<endl;
else if(arr[0]+arr[2]+arr[1]==arr[3])
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
return 0;

}

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution