day13_part2.carbon 629 B

123456789101112131415161718192021222324
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. // https://adventofcode.com/2024/day/13
  5. import Core library "io";
  6. import library "day13_common";
  7. import library "io_utils";
  8. fn Run() {
  9. var total_cost: i64 = 0;
  10. while (true) {
  11. var m: Machine = Machine.Read();
  12. m.prize.0 = m.prize.0 + 10000000000000;
  13. m.prize.1 = m.prize.1 + 10000000000000;
  14. total_cost = total_cost + CostIfPossible(m);
  15. if (not SkipNewline()) {
  16. break;
  17. }
  18. }
  19. PrintInt64(total_cost);
  20. }