Ticker

6/recent/ticker-posts

Olympics Ranking || Codechef || August Challenge 2021 Division 2

 In Olympics, the countries are ranked by the total number of medals won. You are given six integers 

G1S1B1, and G2S2B2, 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.

Input Format 

  • The first line of the input contains a single integer  T denoting the number of test cases. The description of T test cases follows.
  • The first and only line of each test case contains six space-separated integers G1S1B1, and G2S2B2

Output Format


For each test case, print "1" if the first country is ranked better or "2" otherwise. Output the answer without quotes.

Sample Input 

3
10 20 30 0 29 30
 0   0   0  0  0   1
 1   1   1  0  0   0

Sample Output 

1
2
1

Explanation 

Test case 1 :  Total medals for the first country are 10+20+30=60 and that for the second country are  0+29+30=59 So the first country is ranked better than the second country.


Solution : 

Language : PYTH 3.6

S = int(input())
for j in range(S):
      g1,s1,b1,g2,s2,b2 = map(int,input().split())
      if(g1+s1+b1)>(g2+s2+b2):
            print("1")
      else:
            print("2")






Post a Comment

0 Comments