Codeforces 1230A A. Dawid and Bags of Candies SOlution

Solve in C++:

///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE
///Islamic University,Bangladesh

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int ar[10000],s1=0,i,s2=0;
    for(i=0; i<4; i++)
    {
        cin>>ar[i];
    }
    if(ar[0]+ar[1]==ar[2]+ar[3])
        cout<<"YES"<<endl;
    else   if(ar[0]+ar[2]==ar[1]+ar[3])
        cout<<"YES"<<endl;
    else if(ar[0]+ar[3]==ar[1]+ar[2])
        cout<<"YES"<<endl;
    else if(ar[0]+ar[1]+ar[2]==ar[3])
        cout<<"YES"<<endl;
    else if(ar[0]+ar[1]+ar[3]==ar[2])
        cout<<"YES"<<endl;
    else if(ar[0]+ar[3]+ar[2]==ar[1])
        cout<<"YES"<<endl;
    else if(ar[3]+ar[1]+ar[2]==ar[0])
        cout<<"YES"<<endl;
    else
        cout<<"NO"<<endl;
}

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.