-
Notifications
You must be signed in to change notification settings - Fork 0
/
1593A.cpp
30 lines (27 loc) · 933 Bytes
/
1593A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<iostream>
#include<algorithm>
using namespace std;
int how_many_winners(int a, int b, int c, int winner){
int counter = 0;
if(a==winner) counter++;
if(b==winner) counter++;
if(c==winner) counter++;
return counter;
}
int main(){
int a, b, c, t, winner;
cin >> t;
for(int i=0; i<t; i++){
cin >> a >> b >> c;
winner = max(a, max(b, c));
if( how_many_winners(a, b, c, winner) == 1 ){
a == winner ? cout << 0 << " " : cout << winner-a+1 << " ";
b == winner ? cout << 0 << " " : cout << winner-b+1 << " ";
c == winner ? cout << 0 << endl : cout << winner-c+1 << endl;
} else {
a == winner ? cout << 1 << " " : cout << winner-a+1 << " ";
b == winner ? cout << 1 << " " : cout << winner-b+1 << " ";
c == winner ? cout << 1 << endl : cout << winner-c+1 << endl;
}
} return 0;
}