CodeForces - 890A - ACM ICPC【水题】

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a[6], ans = 0;
    for (int i = 0; i < 6; i++){
        cin >> a[i];
        ans += a[i];
    }
    bool flag = false;
    for (int i = 0; i < 6; i++){
        for (int j = 0; j < 6; j++){
            for (int k = 0; k < 6; k++){
                if(i != j && i != k && j != k){
                    if((a[i] + a[j] + a[k]) * 2 == ans)
                        flag = true;
                }
            }
        }
    }
    if(flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

猜你喜欢

转载自blog.csdn.net/qq_37602930/article/details/81150540