ACM ICPC
每个队伍必须是3个人
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> using namespace std; int cmp(const void * x, const void * y) { //x < y return (*((double *)(x))) > (*((double *)(y))) ? 1 : -1; } int a[6]; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); #endif for (int i = 0; i < 6; i++) scanf("%d", &a[i]); int sum = 0; for (int i = 0; i < 6; i++) sum += a[i]; bool f = 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 && j != k && i != k && (a[i] + a[j] + a[k]) * 2 == sum)f = true; } } } if (f) printf("Yes\n"); else printf("No\n"); return 0; }