您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122
  1. def comp(a, nums):
  2. for el in nums:
  3. if a + el == 2020:
  4. return el
  5. return False
  6. def main():
  7. with open("input1a.txt") as file:
  8. lines = file.readlines()
  9. lines = [int(line.strip()) for line in lines]
  10. cur = -1
  11. a, b = -1, -1
  12. while len(lines) > 0:
  13. a = lines.pop()
  14. c = comp(a, lines)
  15. if c:
  16. b = c
  17. break
  18. print(f"{a} * {b} = {a*b}")
  19. if __name__ == "__main__":
  20. main()