T4
2025-01-20 09:09:25
发布于:广东
8阅读
0回复
0点赞
#include <iostream>
#include <algorithm>
int a[4];
using namespace std;
int main() {
int T;
cin >>T;
while(T--){
cin >> a[0] >>a[1] >> a[2];
sort(a, a+3);
int x = 0, y = 0 , z = 0;
if(a[0] %2 == 1) x = 1;
else x = 0;
if(a[1] %2 == 1) y = 1;
else y = 0;
if(a[2] %2 == 1) z = 1;
else z = 0;
int num = 0;
if(x == y && x != z){
a[0] +=1; a[1] += 1;
num +=1;
}else if(x == z && x != y){
a[0] +=1; a[2] += 1;
num +=1;
}else if(y == z && x != z){
a[1] +=1; a[2] += 1;
num +=1;
}
num += (a[2] - a[1])/2 + (a[2] - a[0])/2;
cout <<num << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个