24 lines
581 B
Python
24 lines
581 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
from math import log
|
||
|
|
||
|
def parse(path):
|
||
|
with open(path) as f:
|
||
|
return (tuple(map(int, line.split(","))) for line in f.read().split("\n"))
|
||
|
|
||
|
def main(path):
|
||
|
exps = [exp * log(base) for base, exp in parse(path)]
|
||
|
return exps.index(max(exps)) + 1
|
||
|
|
||
|
def alter(path):
|
||
|
exps = list(parse(path))
|
||
|
copy = exps[:]
|
||
|
while len(exps) > 1:
|
||
|
if exps[0][0] > exps[1][0]**(float(exps[1][1]) // exps[0][1]):
|
||
|
del exps[1]
|
||
|
else:
|
||
|
del exps[0]
|
||
|
return copy.index(exps[0]) + 1
|
||
|
|
||
|
print(main("data/099_base_exp.txt"))
|