Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line, best, bestline, bestrightmost = 0, 0, 0, 0
- for a in list(open("expos.txt")):
- line += 1
- print(line)
- a = a.rstrip()
- temp, nums, product, digits, rightmost = "", [], 1, 0, 0
- for b in a:
- if b == ",":
- nums.append(int(temp))
- temp = ""
- continue
- temp += b
- nums.append(int(temp))
- for c in range(nums[1]):
- product *= nums[0]
- rightmost = int(str(product)[0])
- if len(str(product)) > 8:
- digits += len(str(product)) - 8
- product = int(str(product)[:8])
- if digits > best:
- best = digits
- bestline = line
- if digits == best:
- if rightmost > bestrightmost:
- best = digits
- bestline = line
- bestleftmost = rightmost
- print(bestline)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement