99.py 479 B

123456789101112131415161718192021
  1. from math import log10
  2. # Input file IO
  3. f = open("base_exp.txt", "r")
  4. f = f.read().split()
  5. # Initial variables
  6. maxLine = list(map(float,f[0].split(",")))
  7. maxLineNumber = ""
  8. # Loops through to find biggest numbers
  9. # Uses log10 to avoid exponentiation complexity
  10. for line in f:
  11. exp = line.split(",")
  12. exp = list(map(float, exp))
  13. if (exp[1]*log10(exp[0])) > (maxLine[1]*log10(maxLine[0])):
  14. maxLine = exp
  15. maxLineNumber = f.index(line)
  16. print(maxLine)
  17. print(maxLineNumber + 1)