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

12345678910
  1. def main():
  2. with open("01ain.txt", "r") as file:
  3. lines = file.readlines()
  4. masses = [int(x) for x in lines]
  5. fuels = [(x//3) - 2 for x in masses]
  6. print(fuels)
  7. print(sum(fuels))
  8. if __name__ == "__main__":
  9. main()