Last active
October 26, 2019 17:05
-
-
Save officialcjunior/790c39a798d336d28f8782d0b41521c4 to your computer and use it in GitHub Desktop.
This is the solution for problem 1017A The Rank from codeforces.com, written in Python 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n=int(input()) | |
S=[] | |
for i in range (n): | |
A=[int(i) for i in input().split()] | |
S.append(sum(A)) #S will now have the total marks of all students | |
if S[0]==max(S): | |
print("1") | |
exit() #We handle the case of Thomas being ranked 1 seperately. | |
thomas=S[0] | |
rank=1 | |
S.sort(reverse=True) | |
for i in S: | |
if i==thomas: | |
print(rank) | |
break | |
else: | |
rank += 1 #Then for every i not Thomas' total marks, we increase the rank |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment