소스 검색

Largest exponential

Adel Qalieh 12 년 전
부모
커밋
a96a36f03c
1개의 변경된 파일21개의 추가작업 그리고 0개의 파일을 삭제
  1. 21 0
      99.py

+ 21 - 0
99.py

@@ -0,0 +1,21 @@
+from math import log10
+
+# Input file IO
+f = open("base_exp.txt", "r")
+f = f.read().split()
+
+# Initial variables
+maxLine = list(map(float,f[0].split(",")))
+maxLineNumber = ""
+
+# Loops through to find biggest numbers
+# Uses log10 to avoid exponentiation complexity
+for line in f:
+	exp = line.split(",")
+	exp = list(map(float, exp))
+	if (exp[1]*log10(exp[0])) > (maxLine[1]*log10(maxLine[0])):
+		maxLine = exp
+		maxLineNumber = f.index(line)
+
+print(maxLine)
+print(maxLineNumber + 1)