123456789101112131415161718192021222324 |
- def comp(nums):
- for i in range(len(nums)):
- a = nums[i]
- r = nums[i+1:]
- for j in range(len(r)):
- b = r[j]
- s = r[j+1:]
- for k in range(len(s)):
- c = s[k]
- if a+b+c == 2020:
- return (a,b,c)
- return False
-
- def main():
- with open("input1a.txt") as file:
- lines = file.readlines()
- lines = [int(line.strip()) for line in lines]
-
- a,b,c = comp(lines)
- print(f"{a} * {b} * {c} = {a*b*c}")
-
-
- if __name__ == "__main__":
- main()
|