Olympics Ranking solution codechef
In Olympics, the countries are ranked by the total number of medals won. You are given six integers, , , and , , , the number of gold, silver and bronze medals won by two different counties respectively. Determine which country is ranked better on the leaderboard. It is guaranteed that there will not be a tie between the two countries.
The first line of the input contains a single integerdenoting the number of test cases. The description of test cases follows.
The first and only line of each test case contains six space-separated integers, , , and , , .
For each test case, print
"1" if the first country is ranked better or
"2" otherwise. Output the answer without quotes.
Subtask #1 (100 points): Original constraints
Sample Input 1
3 10 20 30 0 29 30 0 0 0 0 0 1 1 1 1 0 0 0
Sample Output 1
1 2 1
Test case: Total medals for the first country are and that for the second country are . So the first country is ranked better than the second country.
Test case: Total medals for the first country are and that for the second country are . So the second country is ranked better than the first country.