Rice judge (12/96)
This commit is contained in:
27
risdomare.py
Normal file
27
risdomare.py
Normal file
@@ -0,0 +1,27 @@
|
||||
n = int(input())
|
||||
prefer = input()
|
||||
|
||||
bi = 0
|
||||
bt = 0
|
||||
ba = 0
|
||||
bs = 0
|
||||
|
||||
|
||||
for i in range(n):
|
||||
a, s = map(int, input().split())
|
||||
if bt > a + s:
|
||||
continue
|
||||
elif bt == a + s and prefer == "antal" and a > ba:
|
||||
bi = i + 1
|
||||
ba = a
|
||||
bs = s
|
||||
elif bt == a + s and s > bs:
|
||||
bi = i + 1
|
||||
ba = a
|
||||
bs = s
|
||||
elif bt < a + s:
|
||||
bi = i + 1
|
||||
bt = a + s
|
||||
ba = a
|
||||
bs = s
|
||||
print(bi)
|
||||
Reference in New Issue
Block a user