题目
代码
#include <bits/stdc++.h>
using namespace std;
bool func4(vector<int> a, vector<int> b, vector<int> c)
{int x1 = a[0] + a[1], x2 = b[0] + b[1], x3 = c[0] + c[1];for(auto i : a)for(auto j : b)for(auto m : c){if(i == j && j == m) return true;if(i == j && x1 + x2 - i - j == m) return true;if(i == m && x1 + x3 - i - m == j) return true;if(j == m && x2 + x3 - j - m == i) return true;}return false;
}
bool func6(vector<int> a, vector<int> b, vector<int> c)
{for(auto i : a)for(auto j : b)for(auto m : c){if(i == j || i == m || j == m) return true;if(i + j == m || i + m == j || j + m == i) return true;}return false;
}
int main()
{int t;cin >> t;while(t--){vector<int> f(6);for(auto &t : f) cin >> t;vector<int> a(f.begin(), f.begin()+2);vector<int> b(f.begin()+2, f.begin()+4);vector<int> c(f.begin()+4, f.begin()+6);if(func4(a, b, c)){cout << 4 << '\n';continue;}if(func6(a, b, c)) {cout << 6 << '\n';continue;}cout << 8 << '\n';}
}