time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
You are given three positive (i.e. strictly greater than zero) integers xx, yy and zz.
Your task is to find positive integers aa, bb and cc such that x=max(a,b)x=max(a,b), y=max(a,c)y=max(a,c) and z=max(b,c)z=max(b,c), or determine that it is impossible to find such aa, bb and cc.
You have to answer tt independent test cases. Print required aa, bb and cc in any (arbitrary) order.
Input
The first line of the input contains one integer tt (1≤t≤2⋅1041≤t≤2⋅104) — the number of test cases. Then tt test cases follow.
The only line of the test case contains three integers xx, yy, and zz (1≤x,y,z≤1091≤x,y,z≤109).
Output
For each test case, print the answer:
Example
input
Copy
5 3 2 3 100 100 100 50 49 49 10 30 20 1 1000000000 1000000000
output
Copy
YES 3 2 1 YES 100 100 100 NO NO YES 1 1 1000000000
解题说明:此题是一道模拟题,根据题目意思进行x,y,z三个值得比较,然后求解,a,b,c就从x,y,z中选择即可。
#include
int main() {
int t, s;
int x, y, z;
scanf("%d", &t);
for (s = 0; s < t; s++)
{
scanf("%d %d %d", &x, &y, &z);
if (x>y && x == z)
{
printf("YES\n%d %d %d\n", x, y, y);
}
else if (y>x && y == z)
{
printf("YES\n%d %d %d\n", y, x, x);
}
else if (x == y && y > z)
{
printf("YES\n%d %d %d\n", x, z, z);
}
else if (x == y && x == z)
{
printf("YES\n%d %d %d\n", x, x, x);
}
else
{
printf("NO\n");
}
}
return 0;
}