Official
B - コストパフォーマンス最高のノートPC / Best Cost-Performance Laptop Editorial
by
B - コストパフォーマンス最高のノートPC / Best Cost-Performance Laptop Editorial
by
sounansya
問題文の通りに分数の比較を行えば良いです。
from fractions import Fraction
n = int(input())
best = Fraction(0, 1)
ans = -1
for i in range(n):
p, s = map(int, input().split())
val = Fraction(s, p)
if best < val:
best = val
ans = i + 1
print(ans)
posted:
last update:
