Top Scoring Batsman - TEST ODI 20-20

 Coding Problem Keys 

 Top Scoring Batsman - TEST ODI 20-20 

 Problem Statement 

The program must accept the runs scored by N batsmen in the various cricket formats - TEST, ODI and 20-20 and print the top scoring batsman.
    - In case two batsmen have scored same total runs, consider TEST cricket runs. The batsman who has scored higher runs in TEST cricket is the top scoring batsman.
    - In case two batsmen have scored same total runs and have TEST cricket runs equal, consider ODI runs.
    - In case two batsmen have scored same total runs and have TEST and ODI runs equal, consider 20-20 runs.

 Boundary Condition(s) 

1 <= N <= 20

 Input Format 

The first line contains the value of N.
N lines follow with each line containing Batsman Name and runs in TEST, ODI and 20-20 runs (the values are separated by a space).

 Output Format 

The first line contains the name of the top Scoring Batsman.

 Example Input/Output 1 

 Input 

3
Raman 400 300 200
Dujon 800 50 50
Chandan 500 200 200

 Output 

Dujon

 Note: Max Execution Time Limit: 5000 millisecs 

 Solution 

 Programming Language: Python 3 Language 

n=int(input())
l=[]
for i in range(n):
    k=input().split()
    s=[int(i) for i in k[1:]]
    l.append([sum(s),s,k[0]])
l=sorted(l)
print(l[-1][-1])

# Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Toggle Consonants Adjacent to Vowels

String Pattern - Inverted U

Mango Distribution

Desktop Products

Microsoft

Java - Method Overriding - Area