Author: Nicholas Prado <nmprado@nzen.ws>
Date: Sat Dec 4 20:06:31 UTC 2021
Parent: 44b01e5bc184805cbb6a9edc868f3f70e964e210
Log message:
feat 21 04 iterate over array
1: diff --git a/src/java/y2021/Exercise210401.java b/src/java/y2021/Exercise210401.java 2: new file mode 100644 3: index 0000000..edff846 4: --- /dev/null 5: +++ b/src/java/y2021/Exercise210401.java 6: @@ -0,0 +1,235 @@ 7: + 8: +import java.io.IOException; 9: +import java.nio.file.*; 10: +import java.util.*; 11: + 12: +public class Exercise210401 13: +{ 14: + 15: + private BingoCell[][] bingoCells; 16: + private BingoCell[][] bingoCells2; 17: + private BingoCell[][] bingoCells3; 18: + 19: + 20: + public static void main( 21: + String args[] 22: + ) { 23: + final String here = "e210401.m "; 24: + if ( args.length < 1 ) 25: + { 26: + throw new RuntimeException( here +"add a filename argument" ); 27: + } 28: + String userSaysFile = args[ 0 ]; 29: + List<String> fileLines = new LinkedList<>(); 30: + try 31: + { 32: + Path where = Paths.get( userSaysFile ); 33: + fileLines = Files.readAllLines( where ); 34: + } 35: + catch ( IOException | InvalidPathException ie ) 36: + { 37: + System.err.println( here +"couldn't read file "+ userSaysFile +" because "+ ie ); 38: + return; 39: + } 40: + /* 41: + - interpretation of spec - 42: + save drawn numbers 43: + save boards 44: + for board 45: + calculate its time to win 46: + calculate the final score 47: + choose board with the least time to win 48: + */ 49: + new Exercise210401().winBingo( fileLines ); 50: + } 51: + 52: + 53: + private void winBingo( 54: + List<String> fileLines 55: + ) { 56: + // parse called 57: + String[] asciiCalled = fileLines.get( 0 ).split( "," ); 58: + int[] called = new int[ asciiCalled.length ]; 59: + for ( int callInd = 0; callInd < asciiCalled.length; callInd++ ) 60: + called[ callInd ] = Integer.parseInt( asciiCalled[ callInd ] ); 61: + 62: + 63: + // parse boards 64: + List<BingoBoard> boards = new LinkedList<>(); 65: + for ( int lineInd = 2; lineInd < fileLines.size(); lineInd += 6 ) 66: + { 67: + boards.add( new BingoBoard( 68: + fileLines.get( lineInd ), 69: + fileLines.get( lineInd +1 ), 70: + fileLines.get( lineInd +2 ), 71: + fileLines.get( lineInd +3 ), 72: + fileLines.get( lineInd +4 ) ) ); 73: + } 74: + 75: + chooseBoard( boards, called ); 76: + } 77: + 78: + 79: + private void chooseBoard( 80: + List<BingoBoard> boards, int[] called 81: + ) { 82: + int minWinningTurns = Integer.MAX_VALUE; 83: + int winningBoardInd = -1; 84: + for ( int boardInd = 0; boardInd < boards.size(); boardInd++ ) 85: + { 86: + BingoBoard board = boards.get( boardInd ); 87: + calcTurnsToWinOrQuit( board, called, minWinningTurns ); 88: + if ( board.turnsToWin < minWinningTurns && board.finalScore >= 0 ) 89: + { 90: + minWinningTurns = board.turnsToWin; 91: + winningBoardInd = boardInd; 92: + } 93: + } 94: + System.out.println( "\t"+ boards.get( winningBoardInd ).finalScore ); 95: + } 96: + 97: + 98: + private void calcTurnsToWinOrQuit( 99: + BingoBoard board, int[] called, int turnsToBeat 100: + ) { 101: + for ( int turnInd = 0; 102: + turnInd < called.length && turnInd <= turnsToBeat; 103: + turnInd++ ) 104: + { 105: + // mark cell, if applicable 106: + for ( int markRowInd = 0; markRowInd < board.board.length; markRowInd++ ) 107: + { 108: + for ( int markColInd = 0; markColInd < board.board[ markRowInd ].length; markColInd++ ) 109: + { 110: + if ( board.board[ markRowInd ][ markColInd ].value == called[ turnInd ] ) 111: + { 112: + board.board[ markRowInd ][ markColInd ].called = true; 113: + // check if column won 114: + boolean everythingMarked = true; 115: + for ( int scoreRowInd = 0; scoreRowInd < board.board.length; scoreRowInd++ ) 116: + { 117: + everythingMarked &= board.board[ scoreRowInd ][ markColInd ].called; 118: + } 119: + if ( everythingMarked ) 120: + { 121: + board.calcFinalScore( markRowInd, markColInd ); 122: + return; 123: + } 124: + else 125: + { 126: + // check if row won 127: + everythingMarked = true; 128: + for ( int scoreColInd = 0; scoreColInd < board.board.length; scoreColInd++ ) 129: + { 130: + everythingMarked &= board.board[ markRowInd ][ scoreColInd ].called; 131: + } 132: + if ( everythingMarked ) 133: + { 134: + board.calcFinalScore( markRowInd, markColInd ); 135: + board.turnsToWin = turnInd; 136: + return; 137: + } 138: + } 139: + } 140: + } 141: + } 142: + } 143: + } 144: + 145: + 146: + class BingoBoard 147: + { 148: + 149: + final int boardWidth = 5; 150: + int turnsToWin = Integer.MAX_VALUE; 151: + int finalScore = -1; 152: + BingoCell[][] board = new BingoCell[ boardWidth ][ boardWidth ]; 153: + 154: + 155: + public BingoBoard( 156: + String row0, 157: + String row1, 158: + String row2, 159: + String row3, 160: + String row4 161: + ) { 162: + int rowInd = 0; 163: + fillRow( row0, rowInd ); 164: + rowInd++; 165: + fillRow( row1, rowInd ); 166: + rowInd++; 167: + fillRow( row2, rowInd ); 168: + rowInd++; 169: + fillRow( row3, rowInd ); 170: + rowInd++; 171: + fillRow( row4, rowInd ); 172: + rowInd++; 173: + } 174: + 175: + 176: + private void fillRow( 177: + String rowValues, int rowInd 178: + ) { 179: + String[] values = rowValues.split( " " ); 180: + int cellInd = 0; 181: + for ( int valInd = 0; valInd < values.length; valInd++ ) 182: + { 183: + if ( values[ valInd ].isEmpty() ) 184: + continue; 185: + board[ rowInd ][ cellInd ] = new BingoCell( Integer.parseInt( values[ valInd ] ) ); 186: + cellInd++; 187: + } 188: + } 189: + 190: + 191: + private void calcFinalScore( 192: + int lastRowInd, int lastColInd 193: + ) { 194: + finalScore = 0; 195: + for ( int markRowInd = 0; markRowInd < board.length; markRowInd++ ) 196: + { 197: + for ( int markColInd = 0; markColInd < board[ markRowInd ].length; markColInd++ ) 198: + { 199: + if ( ! board[ markRowInd ][ markColInd ].called ) 200: + finalScore += board[ markRowInd ][ markColInd ].value; 201: + } 202: + } 203: + finalScore *= board[ lastRowInd ][ lastColInd ].value; 204: + } 205: + 206: + } 207: + 208: + 209: + class BingoCell 210: + { 211: + int value; 212: + boolean called = false; 213: + 214: + 215: + public BingoCell( 216: + int adopt 217: + ) { 218: + value = adopt; 219: + } 220: + 221: + } 222: + 223: +} 224: + 225: + 226: + 227: + 228: + 229: + 230: + 231: + 232: + 233: + 234: + 235: + 236: + 237: + 238: + 239: + 240: + 241: + 242: diff --git a/src/java/y2021/Exercise210402.java b/src/java/y2021/Exercise210402.java 243: new file mode 100644 244: index 0000000..5d2efed 245: --- /dev/null 246: +++ b/src/java/y2021/Exercise210402.java 247: @@ -0,0 +1,231 @@ 248: + 249: +import java.io.IOException; 250: +import java.nio.file.*; 251: +import java.util.*; 252: + 253: +public class Exercise210402 254: +{ 255: + 256: + 257: + public static void main( 258: + String args[] 259: + ) { 260: + final String here = "e210402.m "; 261: + if ( args.length < 1 ) 262: + { 263: + throw new RuntimeException( here +"add a filename argument" ); 264: + } 265: + String userSaysFile = args[ 0 ]; 266: + List<String> fileLines = new LinkedList<>(); 267: + try 268: + { 269: + Path where = Paths.get( userSaysFile ); 270: + fileLines = Files.readAllLines( where ); 271: + } 272: + catch ( IOException | InvalidPathException ie ) 273: + { 274: + System.err.println( here +"couldn't read file "+ userSaysFile +" because "+ ie ); 275: + return; 276: + } 277: + /* 278: + - interpretation of spec - 279: + save drawn numbers 280: + save boards 281: + for board 282: + calculate its time to win 283: + calculate the final score 284: + choose board with the least time to win 285: + */ 286: + new Exercise210402().winBingo( fileLines ); 287: + } 288: + 289: + 290: + private void winBingo( 291: + List<String> fileLines 292: + ) { 293: + // parse called 294: + String[] asciiCalled = fileLines.get( 0 ).split( "," ); 295: + int[] called = new int[ asciiCalled.length ]; 296: + for ( int callInd = 0; callInd < asciiCalled.length; callInd++ ) 297: + called[ callInd ] = Integer.parseInt( asciiCalled[ callInd ] ); 298: + 299: + 300: + // parse boards 301: + List<BingoBoard> boards = new LinkedList<>(); 302: + for ( int lineInd = 2; lineInd < fileLines.size(); lineInd += 6 ) 303: + { 304: + boards.add( new BingoBoard( 305: + fileLines.get( lineInd ), 306: + fileLines.get( lineInd +1 ), 307: + fileLines.get( lineInd +2 ), 308: + fileLines.get( lineInd +3 ), 309: + fileLines.get( lineInd +4 ) ) ); 310: + } 311: + 312: + chooseBoard( boards, called ); 313: + } 314: + 315: + 316: + private void chooseBoard( 317: + List<BingoBoard> boards, int[] called 318: + ) { 319: + int maxWinningTurns = -1; 320: + int winningBoardInd = -1; 321: + for ( int boardInd = 0; boardInd < boards.size(); boardInd++ ) 322: + { 323: + BingoBoard board = boards.get( boardInd ); 324: + calcTurnsToWinOrQuit( board, called, maxWinningTurns ); 325: + if ( board.turnsToWin > maxWinningTurns && board.finalScore >= 0 ) 326: + { 327: + maxWinningTurns = board.turnsToWin; 328: + winningBoardInd = boardInd; 329: + } 330: + } 331: + System.out.println( "\t"+ boards.get( winningBoardInd ).finalScore ); 332: + } 333: + 334: + 335: + private void calcTurnsToWinOrQuit( 336: + BingoBoard board, int[] called, int turnsToBeat 337: + ) { 338: + for ( int turnInd = 0; 339: + turnInd < called.length; // && turnInd <= turnsToBeat; 340: + turnInd++ ) 341: + { 342: + // mark cell, if applicable 343: + for ( int markRowInd = 0; markRowInd < board.board.length; markRowInd++ ) 344: + { 345: + for ( int markColInd = 0; markColInd < board.board[ markRowInd ].length; markColInd++ ) 346: + { 347: + if ( board.board[ markRowInd ][ markColInd ].value == called[ turnInd ] ) 348: + { 349: + board.board[ markRowInd ][ markColInd ].called = true; 350: + // check if column won 351: + boolean everythingMarked = true; 352: + for ( int scoreRowInd = 0; scoreRowInd < board.board.length; scoreRowInd++ ) 353: + { 354: + everythingMarked &= board.board[ scoreRowInd ][ markColInd ].called; 355: + } 356: + if ( everythingMarked ) 357: + { 358: + board.calcFinalScore( markRowInd, markColInd ); 359: + return; 360: + } 361: + else 362: + { 363: + // check if row won 364: + everythingMarked = true; 365: + for ( int scoreColInd = 0; scoreColInd < board.board.length; scoreColInd++ ) 366: + { 367: + everythingMarked &= board.board[ markRowInd ][ scoreColInd ].called; 368: + } 369: + if ( everythingMarked ) 370: + { 371: + board.calcFinalScore( markRowInd, markColInd ); 372: + board.turnsToWin = turnInd; 373: + return; 374: + } 375: + } 376: + } 377: + } 378: + } 379: + } 380: + } 381: + 382: + 383: + class BingoBoard 384: + { 385: + 386: + final int boardWidth = 5; 387: + int turnsToWin = Integer.MIN_VALUE; 388: + int finalScore = -1; 389: + BingoCell[][] board = new BingoCell[ boardWidth ][ boardWidth ]; 390: + 391: + 392: + public BingoBoard( 393: + String row0, 394: + String row1, 395: + String row2, 396: + String row3, 397: + String row4 398: + ) { 399: + int rowInd = 0; 400: + fillRow( row0, rowInd ); 401: + rowInd++; 402: + fillRow( row1, rowInd ); 403: + rowInd++; 404: + fillRow( row2, rowInd ); 405: + rowInd++; 406: + fillRow( row3, rowInd ); 407: + rowInd++; 408: + fillRow( row4, rowInd ); 409: + rowInd++; 410: + } 411: + 412: + 413: + private void fillRow( 414: + String rowValues, int rowInd 415: + ) { 416: + String[] values = rowValues.split( " " ); 417: + int cellInd = 0; 418: + for ( int valInd = 0; valInd < values.length; valInd++ ) 419: + { 420: + if ( values[ valInd ].isEmpty() ) 421: + continue; 422: + board[ rowInd ][ cellInd ] = new BingoCell( Integer.parseInt( values[ valInd ] ) ); 423: + cellInd++; 424: + } 425: + } 426: + 427: + 428: + private void calcFinalScore( 429: + int lastRowInd, int lastColInd 430: + ) { 431: + finalScore = 0; 432: + for ( int markRowInd = 0; markRowInd < board.length; markRowInd++ ) 433: + { 434: + for ( int markColInd = 0; markColInd < board[ markRowInd ].length; markColInd++ ) 435: + { 436: + if ( ! board[ markRowInd ][ markColInd ].called ) 437: + finalScore += board[ markRowInd ][ markColInd ].value; 438: + } 439: + } 440: + finalScore *= board[ lastRowInd ][ lastColInd ].value; 441: + } 442: + 443: + } 444: + 445: + 446: + class BingoCell 447: + { 448: + int value; 449: + boolean called = false; 450: + 451: + 452: + public BingoCell( 453: + int adopt 454: + ) { 455: + value = adopt; 456: + } 457: + 458: + } 459: + 460: +} 461: + 462: + 463: + 464: + 465: + 466: + 467: + 468: + 469: + 470: + 471: + 472: + 473: + 474: + 475: + 476: + 477: + 478: + 479: diff --git a/src/res/y2021/21_04_example.txt b/src/res/y2021/21_04_example.txt 480: new file mode 100644 481: index 0000000..49d17bc 482: --- /dev/null 483: +++ b/src/res/y2021/21_04_example.txt 484: @@ -0,0 +1,19 @@ 485: +7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1 486: + 487: +22 13 17 11 0 488: + 8 2 23 4 24 489: +21 9 14 16 7 490: + 6 10 3 18 5 491: + 1 12 20 15 19 492: + 493: + 3 15 0 2 22 494: + 9 18 13 17 5 495: +19 8 7 25 23 496: +20 11 10 24 4 497: +14 21 16 12 6 498: + 499: +14 21 17 24 4 500: +10 16 15 9 19 501: +18 8 23 26 20 502: +22 11 13 6 5 503: + 2 0 12 3 7 504: \ No newline at end of file 505: diff --git a/src/res/y2021/21_04_input.txt b/src/res/y2021/21_04_input.txt 506: new file mode 100644 507: index 0000000..780a141 508: --- /dev/null 509: +++ b/src/res/y2021/21_04_input.txt 510: @@ -0,0 +1,601 @@ 511: +67,31,58,8,79,18,19,45,38,13,40,62,85,10,21,96,56,55,4,36,76,42,32,34,39,89,6,12,24,57,93,47,41,52,83,61,5,37,28,15,86,23,69,92,70,27,25,53,44,80,65,22,99,43,66,26,11,72,2,98,14,82,87,20,73,46,35,7,1,84,95,74,81,63,78,94,16,60,29,97,91,30,17,54,68,90,71,88,77,9,64,50,0,49,48,75,3,59,51,33 512: + 513: +12 75 58 21 87 514: +55 80 14 63 17 515: +37 35 76 92 56 516: +72 68 51 19 38 517: +91 60 34 30 88 518: + 519: + 0 66 5 51 8 520: +45 57 31 3 62 521: + 7 60 40 29 90 522: +80 19 47 86 81 523: +95 69 68 53 93 524: + 525: +30 99 16 34 42 526: +94 39 83 78 49 527: +57 81 97 77 52 528: + 9 61 98 11 89 529: +85 1 60 90 55 530: + 531: +87 49 12 85 88 532: +67 89 7 35 70 533: +37 45 93 84 9 534: +80 58 54 13 22 535: + 8 71 48 15 39 536: + 537: +40 79 34 18 42 538: +35 8 64 5 63 539: +93 57 16 10 96 540: +22 20 23 0 86 541: +61 78 68 83 12 542: + 543: +43 78 64 70 49 544: +60 54 31 82 9 545: +10 69 2 1 50 546: +37 12 16 77 25 547: +18 14 57 13 91 548: + 549: +42 85 53 57 52 550: +19 41 84 68 28 551: +39 22 55 51 87 552: +49 23 5 66 71 553: +72 83 86 35 50 554: + 555: +91 75 9 62 82 556: +47 37 94 6 55 557: +96 38 8 19 22 558: +46 66 54 43 59 559: + 1 0 26 36 74 560: + 561: +19 78 25 10 80 562: +23 88 95 42 11 563: +54 85 52 92 31 564: +73 87 9 17 93 565: + 2 46 12 24 83 566: + 567: +84 73 85 51 89 568: +41 26 98 11 29 569: +81 6 35 39 76 570: +27 10 49 4 92 571: +55 43 28 45 88 572: + 573: +23 0 19 26 73 574: +72 42 40 58 38 575: +36 46 18 89 52 576: +85 35 50 13 1 577: +66 57 45 81 25 578: + 579: +11 71 35 0 95 580: +45 16 78 33 31 581: +30 34 25 91 36 582: +83 58 8 3 62 583: +67 14 72 93 28 584: + 585: +63 41 19 80 27 586: +69 15 99 75 95 587: +47 86 52 22 12 588: +66 43 37 6 97 589: +13 1 5 71 83 590: + 591: +19 42 85 53 31 592: +36 14 75 39 74 593: +70 86 97 72 69 594: +15 20 41 6 21 595: +26 33 48 98 34 596: + 597: + 1 79 21 38 44 598: +63 71 14 17 87 599: +41 76 56 49 59 600: + 3 18 6 4 77 601: +34 19 88 24 10 602: + 603: +78 20 30 54 92 604: +25 63 81 0 69 605: +46 87 26 56 40 606: +90 82 50 84 66 607: +96 41 18 29 23 608: + 609: +34 1 59 55 30 610: +97 19 82 23 77 611: +21 52 56 48 24 612: +29 43 28 99 69 613: + 4 37 84 76 58 614: + 615: +96 10 11 79 40 616: +90 29 59 73 84 617: +16 62 74 42 92 618: +43 32 58 46 34 619: +75 12 57 22 15 620: + 621: +29 82 47 16 12 622: +78 84 83 0 77 623: +51 64 5 37 7 624: +49 70 19 69 8 625: +67 63 6 43 79 626: + 627: +87 67 52 64 8 628: +55 43 82 50 13 629: + 3 19 94 54 83 630: +80 59 15 32 37 631: + 0 58 12 89 96 632: + 633: +95 31 14 77 83 634: +26 68 33 39 85 635: +71 56 45 46 30 636: +44 93 16 17 52 637: +86 8 27 3 25 638: + 639: +27 67 81 30 95 640: +48 89 7 4 3 641: +82 90 78 85 44 642: +22 16 97 92 11 643: +15 87 47 79 62 644: + 645: +49 51 35 87 75 646: + 3 70 8 43 5 647: +77 88 73 81 29 648: +42 62 50 37 85 649: +26 86 14 38 65 650: + 651: +81 9 84 3 37 652: +33 32 1 54 45 653: +39 83 82 36 2 654: +56 28 76 85 40 655: +96 69 43 24 71 656: + 657: +83 72 50 46 34 658: +15 51 87 44 71 659: + 8 78 10 94 11 660: +67 40 85 93 35 661: +17 23 24 0 61 662: + 663: +62 55 47 77 95 664: +81 20 35 8 78 665: + 7 9 89 27 51 666: +80 39 33 63 50 667: +67 34 4 87 57 668: + 669: +72 88 74 46 91 670: +67 66 32 0 9 671: + 3 69 94 6 81 672: +40 95 29 83 20 673: +80 68 55 54 2 674: + 675: +72 68 65 91 81 676: +52 34 88 46 48 677: +66 4 54 27 62 678: +83 60 69 26 56 679: +19 11 35 22 84 680: + 681: +72 69 92 87 83 682: +55 95 85 66 1 683: +16 3 86 5 99 684: +24 22 29 53 90 685: +76 73 48 80 42 686: + 687: +38 22 94 50 20 688: +40 52 61 39 62 689: + 7 35 95 54 66 690: +37 59 84 76 2 691: +81 85 0 48 6 692: + 693: +90 95 34 93 8 694: +46 13 6 58 85 695: +91 89 83 80 18 696: +56 57 44 99 17 697: +21 42 12 74 38 698: + 699: +28 61 78 99 23 700: +75 64 37 66 50 701: +53 70 89 17 63 702: +43 38 71 26 85 703: + 4 13 2 27 18 704: + 705: +35 12 60 7 29 706: +87 65 17 81 10 707: +42 62 99 38 51 708: + 2 57 92 27 89 709: +82 58 97 36 72 710: + 711: +43 45 5 99 51 712: +88 4 13 39 95 713: +44 56 31 33 94 714: +37 57 12 3 91 715: +50 74 6 76 30 716: + 717: +67 85 56 69 84 718: +74 65 61 66 8 719: +43 50 55 25 97 720: +78 15 49 73 27 721: +71 44 93 23 64 722: + 723: +83 38 97 85 76 724: +55 90 46 34 12 725: + 1 52 18 59 48 726: +62 63 30 82 92 727: +68 95 0 72 84 728: + 729: +40 10 62 77 75 730: +93 94 32 27 60 731: +26 12 14 35 57 732: +88 53 97 95 24 733: +66 46 33 3 63 734: + 735: +25 44 90 34 17 736: +91 93 42 37 86 737: +95 41 82 92 31 738: +65 35 52 40 84 739: +85 57 71 19 29 740: + 741: +77 38 15 12 9 742: +65 78 39 81 33 743: +35 64 96 76 71 744: +68 93 79 22 40 745: +88 87 27 7 29 746: + 747: +10 81 7 92 64 748: +60 25 11 6 87 749: +34 49 20 13 0 750: +48 38 14 61 75 751: +71 86 39 37 22 752: + 753: +63 67 82 98 18 754: +11 95 4 55 44 755: +42 10 84 73 19 756: +17 57 53 61 49 757: + 7 32 24 75 58 758: + 759: +50 90 1 98 41 760: +77 4 87 69 19 761: +48 44 68 10 17 762: +96 66 71 61 45 763: +18 86 26 73 16 764: + 765: + 5 58 68 34 85 766: +44 89 72 21 27 767: + 0 50 39 94 82 768: +23 13 41 81 6 769: +83 60 61 22 40 770: + 771: +59 41 63 92 69 772: +10 58 29 60 4 773: +76 15 46 34 85 774: +13 17 88 86 24 775: +62 73 19 67 98 776: + 777: +96 69 70 87 80 778: +28 27 40 77 9 779: +23 52 99 3 60 780: +81 53 26 45 35 781: +82 33 71 43 67 782: + 783: +30 8 41 71 26 784: +97 96 0 45 11 785: +61 12 91 7 50 786: +22 40 74 55 29 787: +53 78 43 15 5 788: + 789: +93 25 12 62 84 790: +95 31 87 83 23 791: +29 41 6 55 17 792: +33 85 42 20 56 793: +57 1 65 45 16 794: + 795: +76 86 27 75 96 796: +56 63 45 25 77 797: +54 44 64 41 13 798: +60 46 66 12 67 799: +84 59 39 24 5 800: + 801: +79 39 22 84 66 802: +76 38 99 21 47 803: +52 73 7 45 94 804: +70 78 24 16 40 805: +48 57 9 13 64 806: + 807: +17 80 28 51 94 808: +52 56 24 65 82 809: +38 96 21 70 23 810: +60 50 40 32 91 811: +45 77 37 44 89 812: + 813: +18 3 42 68 66 814: +22 35 95 29 65 815: + 8 99 72 19 5 816: +44 80 11 60 76 817: +59 90 64 57 94 818: + 819: +66 97 62 49 89 820: + 4 41 5 2 23 821: +54 48 43 45 76 822: +68 35 14 1 86 823: +34 47 26 92 95 824: + 825: +57 36 52 42 11 826: +49 83 94 72 26 827: +91 48 50 88 80 828: +70 23 81 33 15 829: +64 90 2 47 18 830: + 831: +68 11 16 77 28 832: +29 56 81 21 63 833: + 2 88 54 82 40 834: +69 93 92 55 70 835: +57 51 25 80 3 836: + 837: +10 73 8 27 61 838: +74 66 47 54 1 839: +52 17 76 5 20 840: +70 44 92 59 34 841: +26 16 11 81 46 842: + 843: +10 31 95 17 44 844: +76 67 19 69 33 845: +36 70 25 71 99 846: +56 42 53 46 40 847: +90 85 81 6 26 848: + 849: +17 32 74 57 64 850: +37 82 92 54 59 851: +56 87 41 68 73 852: +44 98 58 95 53 853: +47 29 71 52 31 854: + 855: +19 58 84 14 91 856: +75 89 18 67 3 857: +11 5 2 24 37 858: +62 35 48 56 81 859: +54 77 16 70 45 860: + 861: + 7 20 41 87 74 862: +17 47 45 96 49 863: + 4 33 89 31 77 864: +79 42 52 29 85 865: +88 27 63 11 75 866: + 867: +61 87 90 15 17 868: +22 82 28 21 93 869: +65 98 12 23 24 870: +73 70 42 1 94 871: +83 79 5 18 55 872: + 873: +78 67 22 88 18 874: + 2 43 14 56 92 875: +61 32 87 20 8 876: +28 11 7 12 70 877: +21 72 36 74 77 878: + 879: +27 6 97 66 7 880: +30 67 12 70 40 881: +18 61 78 36 23 882: +44 24 85 74 82 883: +55 42 51 90 34 884: + 885: +98 9 39 42 44 886: +50 54 43 66 57 887: +85 58 91 13 11 888: +67 5 23 59 70 889: +45 41 87 29 20 890: + 891: +97 57 48 42 73 892: +37 29 50 49 83 893: +55 38 69 13 44 894: +52 14 54 94 56 895: +24 77 16 39 66 896: + 897: +31 61 44 38 80 898: +11 3 0 56 8 899: +94 81 1 25 19 900: +71 23 36 66 41 901: +70 35 77 79 46 902: + 903: +17 96 13 25 48 904: +65 28 41 24 81 905: +39 87 74 42 5 906: +36 35 21 60 40 907: + 3 83 11 1 34 908: + 909: +50 52 84 38 57 910: +15 20 26 3 72 911: +48 85 4 88 63 912: +39 34 32 42 7 913: +86 77 71 94 23 914: + 915: +28 60 13 25 0 916: +22 74 20 75 30 917: +97 5 21 2 73 918: + 7 44 14 77 16 919: +43 68 76 24 1 920: + 921: +99 85 4 62 67 922: +46 86 43 45 77 923: +42 21 81 47 57 924: +71 35 23 10 29 925: +58 60 79 61 48 926: + 927: +33 10 7 61 17 928: +97 91 70 75 48 929: +81 80 78 34 36 930: +26 55 73 77 14 931: +85 84 62 9 16 932: + 933: +17 41 3 82 86 934: +58 0 51 79 29 935: +60 70 61 95 46 936: +98 85 1 72 93 937: + 4 42 89 88 84 938: + 939: +95 16 26 32 29 940: +27 37 51 23 55 941: +36 10 50 70 57 942: +60 79 96 40 9 943: + 3 43 74 94 31 944: + 945: +15 56 51 72 62 946: + 8 63 23 90 67 947: +93 85 28 70 82 948: +33 65 89 4 64 949: +19 58 37 88 75 950: + 951: +34 71 60 84 85 952: +64 87 92 67 8 953: +42 58 4 9 75 954: +49 95 26 91 12 955: +27 56 74 90 20 956: + 957: +13 46 27 12 97 958: +90 25 87 73 41 959: +50 66 34 15 94 960: +45 99 88 86 21 961: +56 37 62 44 29 962: + 963: +77 31 59 94 74 964: +19 15 11 23 68 965: + 0 36 2 98 30 966: +44 49 90 83 9 967: +13 88 69 66 81 968: + 969: +31 71 58 11 47 970: +42 41 10 83 21 971: +38 9 51 17 64 972: +37 13 93 81 39 973: +33 22 98 26 43 974: + 975: +60 89 20 94 2 976: +45 34 93 15 30 977: + 4 16 49 92 28 978: +67 75 27 61 70 979: +25 84 55 91 88 980: + 981: +85 22 41 43 0 982: +21 77 12 64 34 983: +30 39 97 36 72 984: +56 8 65 82 84 985: +76 3 4 17 49 986: + 987: +16 61 63 41 47 988: +48 46 37 70 87 989: +57 31 36 83 1 990: +71 3 93 24 80 991: +51 78 91 17 86 992: + 993: +87 72 70 97 58 994: +54 16 1 43 46 995: +49 28 59 38 51 996: +24 15 10 84 94 997: +76 86 55 83 26 998: + 999: +93 10 5 1 92 1000: +99 6 45 79 76 1001: +74 87 47 25 24 1002: +50 43 4 21 67 1003: +81 39 49 12 86 1004: + 1005: +49 35 22 27 37 1006: +90 80 68 52 59 1007: +78 53 23 65 46 1008: +30 61 75 97 31 1009: + 1 76 66 26 48 1010: + 1011: +37 11 88 20 99 1012: +45 96 95 81 39 1013: +60 55 80 58 53 1014: + 6 23 8 1 46 1015: +98 89 16 73 78 1016: + 1017: + 0 58 88 69 66 1018: +82 9 31 97 55 1019: +22 37 90 79 14 1020: +44 45 49 43 60 1021: +93 62 36 57 30 1022: + 1023: + 1 34 89 90 46 1024: +81 26 5 6 14 1025: +75 74 62 55 37 1026: +96 58 78 93 73 1027: +35 40 13 95 45 1028: + 1029: +22 57 46 99 42 1030: +65 39 38 7 81 1031: + 4 1 76 59 8 1032: +84 60 37 55 40 1033: +49 31 5 80 30 1034: + 1035: +29 4 96 50 24 1036: +61 77 70 88 93 1037: +12 64 52 25 90 1038: +67 34 59 95 16 1039: +79 21 82 6 63 1040: + 1041: +26 41 52 91 57 1042: +92 95 33 1 62 1043: +45 31 87 29 59 1044: +44 86 99 81 5 1045: +36 20 58 73 30 1046: + 1047: +55 96 28 26 17 1048: +62 51 64 43 49 1049: +37 41 36 75 42 1050: +11 94 87 27 63 1051: +35 23 21 29 4 1052: + 1053: +99 54 74 83 92 1054: +27 53 15 8 85 1055: +94 36 63 29 91 1056: +58 10 45 38 79 1057: + 9 95 23 98 33 1058: + 1059: +52 14 99 30 50 1060: +29 81 41 28 15 1061: +43 51 61 56 62 1062: +68 67 93 45 13 1063: +23 6 70 8 7 1064: + 1065: +73 78 47 2 7 1066: +45 16 46 65 21 1067: +60 54 43 12 1 1068: +20 23 42 56 81 1069: +89 80 52 26 32 1070: + 1071: +79 5 10 11 7 1072: +87 36 2 70 16 1073: +99 44 49 43 19 1074: +46 25 1 18 78 1075: +55 76 3 73 15 1076: + 1077: +18 49 71 59 90 1078: +97 37 23 68 62 1079: +48 8 14 81 26 1080: +88 4 22 76 12 1081: +60 99 64 17 46 1082: + 1083: +99 25 79 42 33 1084: + 5 28 38 15 11 1085: + 8 78 51 40 65 1086: +47 0 12 48 67 1087: +14 98 53 43 86 1088: + 1089: +74 46 42 86 44 1090: +83 96 61 38 70 1091: +97 7 49 9 22 1092: +65 34 66 90 51 1093: + 0 36 13 85 53 1094: + 1095: +43 21 64 86 20 1096: + 8 55 85 48 15 1097: +58 49 87 29 35 1098: +74 4 37 12 99 1099: +98 69 75 39 71 1100: + 1101: +58 65 63 41 87 1102: +19 49 91 34 37 1103: +95 10 55 94 82 1104: +78 71 66 60 96 1105: +27 11 29 48 72 1106: + 1107: + 9 78 51 18 93 1108: +71 55 0 5 37 1109: +24 98 2 70 92 1110: +85 15 46 91 99 1111: +60 68 41 86 96 1112: diff --git a/src/res/y2021/21_04_solutions.txt b/src/res/y2021/21_04_solutions.txt 1113: new file mode 100644 1114: index 0000000..ec84025 1115: --- /dev/null 1116: +++ b/src/res/y2021/21_04_solutions.txt 1117: @@ -0,0 +1,6 @@ 1118: + 1119: +example 1 : 4512 1120: +puzzle 1 : 10680 1121: + 1122: +example 2 : 1924 1123: +puzzle 2 : 31892