feat: implement day 09

This commit is contained in:
Lennard Brinkhaus 2023-12-09 12:44:21 +01:00
parent b83fddc560
commit a77190c4ce
4 changed files with 340 additions and 1 deletions

View File

@ -79,7 +79,7 @@ fn solve_02(content: &str) -> anyhow::Result<u64> {
}); });
}); });
let mut keys = nodes.keys().filter(|key| key.ends_with("A")).map(|str| str.to_owned()).collect::<Vec<String>>(); let keys = nodes.keys().filter(|key| key.ends_with("A")).map(|str| str.to_owned()).collect::<Vec<String>>();
//let end = nodes.keys().filter(|key| key.ends_with("Z")).map(|str| str.to_owned()).collect::<HashSet<String>>(); //let end = nodes.keys().filter(|key| key.ends_with("Z")).map(|str| str.to_owned()).collect::<HashSet<String>>();
let cmds = cmds.chars(); let cmds = cmds.chars();

134
src/day09.rs Normal file
View File

@ -0,0 +1,134 @@
use std::time::Instant;
pub fn execute_task01(content: &str) {
let start = Instant::now();
let sum_of_b = solve_01(content).unwrap();
let duration = start.elapsed();
assert_eq!(1953784198, sum_of_b);
println!("Day09 - Task01 - Duration: {duration:?} - Sum of B: {}", sum_of_b)
}
pub fn execute_task02(content: &str) {
let start = Instant::now();
let command_steps = solve_02(content).unwrap();
let duration = start.elapsed();
assert_eq!(957, command_steps);
println!("Day09 - Task02 - Duration: {duration:?} - Sum of B: {}", command_steps)
}
fn solve_01(content: &str) -> anyhow::Result<i64> {
Ok(content
.lines()
.map(|line| line
.split(" ")
.map(|num| num.parse::<i64>().unwrap())
.collect::<Vec<i64>>())
.map(|data_line| build_tree(data_line))
.map(|tree| expand_tree_width_right(tree))
.map(|tree| tree.first().unwrap().last().unwrap().to_owned())
.sum())
}
fn solve_02(content: &str) -> anyhow::Result<i64> {
Ok(content
.lines()
.map(|line| line
.split(" ")
.map(|num| num.parse::<i64>().unwrap())
.collect::<Vec<i64>>())
.map(|data_line| build_tree(data_line))
.map(|tree| expand_tree_width_left(tree))
.map(|tree| tree.first().unwrap().first().unwrap().to_owned())
.sum())
}
fn build_tree(line: Vec<i64>) -> Vec<Vec<i64>> {
let mut tree = vec![line];
loop {
let last_layer = tree.last().unwrap();
if last_layer.iter().filter(|num| num != &&0).count() == 0 {
return tree
}
let mut new_layer = vec![];
for (index, item) in last_layer.iter().enumerate() {
if index + 1 >= last_layer.len() {
break
}
new_layer.push( last_layer[index+1] - item)
}
tree.push(new_layer);
}
}
fn expand_tree_width_right(tree: Vec<Vec<i64>>) -> Vec<Vec<i64>> {
let mut tree = tree.clone();
let tree_lines = tree.len();
for index in 0..tree_lines {
if index == 0 {
tree.last_mut().unwrap().push(0);
continue
}
let line = tree[tree_lines - 1 - index].clone();
let line_before = tree[tree_lines - index].clone();
tree
.get_mut(tree_lines - 1 - index)
.unwrap()
.push(line.last().unwrap() + line_before.last().unwrap().clone())
}
tree
}
fn expand_tree_width_left(tree: Vec<Vec<i64>>) -> Vec<Vec<i64>> {
let mut tree = tree.clone();
let tree_lines = tree.len();
for index in 0..tree_lines {
if index == 0 {
tree.last_mut().unwrap().insert(0, 0);
continue
}
let line = tree[tree_lines - 1 - index].clone();
let line_before = tree[tree_lines - index].clone();
tree
.get_mut(tree_lines - 1 - index)
.unwrap()
.insert(0, line.first().unwrap() - line_before.first().unwrap().clone() )
}
tree
}
#[test]
fn test_solve_01() {
let example = r#"0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45"#;
let result = solve_01(example).unwrap();
assert_eq!(114, result);
}
#[test]
fn test_solve_02() {
let example = r#"0 3 6 9 12 15
1 3 6 10 15 21
10 13 16 21 30 45"#;
let result = solve_02(example).unwrap();
assert_eq!(2, result);
}

200
src/input/day09/input.txt Normal file
View File

@ -0,0 +1,200 @@
24 38 52 66 80 94 108 122 136 150 164 178 192 206 220 234 248 262 276 290 304
1 6 8 2 -10 -6 67 305 879 2127 4775 10402 22342 47347 98546 200559 398101 770084 1452146 2671762 4801686
13 21 20 3 -33 -68 -21 310 1329 3739 8646 17657 32955 57330 94141 147180 220405 317505 441256 592623 769559
13 25 45 73 109 153 205 265 333 409 493 585 685 793 909 1033 1165 1305 1453 1609 1773
0 4 24 80 206 467 1004 2133 4538 9611 20002 40447 78940 148304 268194 467530 787308 1283670 2031028 3124930 4684226
0 6 15 26 44 96 265 744 1918 4505 9833 20404 41003 80756 156734 299951 564928 1044412 1891375 3351106 5807090
17 27 38 52 80 152 341 817 1966 4641 10659 23733 51168 106936 217333 431587 841987 1622055 3098056 5880270 11098060
18 45 87 142 216 335 557 984 1774 3153 5427 8994 14356 22131 33065 48044 68106 94453 128463 171702 225936
2 18 48 99 198 401 809 1616 3235 6592 13768 29342 63099 135289 286447 595028 1207951 2391885 4617303 8693984 15987511
4 15 44 91 151 223 342 661 1632 4374 11397 28029 65268 145513 313952 660626 1361776 2754565 5467334 10639035 20277385
2 19 61 153 344 716 1392 2546 4418 7337 11755 18295 27816 41498 60950 88344 126578 179471 251993 350533 483208
-1 -6 -17 -25 -11 54 209 503 995 1754 2859 4399 6473 9190 12669 17039 22439 29018 36935 46359 57469
11 9 -1 -14 -15 32 205 655 1647 3611 7203 13376 23461 39258 63137 98149 148147 217917 313319 441438 610745
9 29 58 95 143 213 330 540 917 1569 2642 4321 6827 10409 15330 21846 30177 40469 52746 66851 82375
-4 2 26 80 184 370 679 1148 1788 2561 3376 4145 4976 6639 11533 25519 61180 143340 318038 666630 1327304
-3 1 14 36 74 155 342 758 1626 3338 6586 12643 23999 45770 88648 174695 348059 693767 1369198 2654734 5032512
0 3 21 65 145 280 531 1066 2272 4943 10595 21989 43981 84864 158421 286970 505752 869091 1458841 2395729 3854305
15 23 41 86 192 422 880 1723 3173 5529 9179 14612 22430 33360 48266 68161 94219 127787 170397 223778 289868
-7 -12 -15 -11 19 114 348 870 1996 4404 9535 20415 43342 91334 191113 397086 818939 1675156 3394633 6804881 13471197
10 31 77 170 346 660 1191 2054 3428 5606 9065 14541 23076 35981 54631 79975 111606 146193 175029 180396 130390
28 49 79 126 209 378 745 1526 3096 6074 11499 21264 39205 73711 143659 291374 610212 1302414 2799283 6008265 12813801
24 54 102 180 322 609 1204 2395 4644 8640 15354 26094 42558 66883 101688 150109 215824 303066 416622 561816 744474
9 17 29 46 89 221 583 1466 3461 7762 16757 35145 71992 144454 284498 551127 1052853 1989247 3727505 6941792 12861991
-8 -3 18 75 202 460 963 1918 3688 6915 12797 23704 44444 84648 162926 313643 597360 1116161 2035220 3612025 6234638
14 18 28 53 109 239 550 1268 2817 5955 12060 23768 46353 90573 178344 353904 705847 1411031 2822647 5646510 11290008
7 14 36 88 200 425 844 1568 2737 4516 7088 10644 15370 21431 28952 37996 48539 60442 73420 87008 100524
16 22 30 53 121 287 629 1245 2238 3688 5607 7872 10133 11703 11462 7856 -844 -15726 -35372 -52177 -45711
-5 -8 -14 -26 -39 -31 62 400 1335 3562 8338 17782 35269 65931 117278 199952 328627 523068 809362 1221334 1802161
7 8 17 37 64 95 147 287 673 1606 3593 7421 14242 25669 43883 71751 112955 172132 255025 368645 521444
19 32 51 74 89 68 -27 -204 -331 94 2367 9343 26904 67034 154615 342558 744830 1606519 3448414 7358263 15565478
25 43 66 105 193 402 866 1814 3626 6940 12859 23334 41832 74437 131577 230621 399647 682745 1147288 1893679 3068163
10 9 16 44 108 222 396 633 926 1255 1584 1858 2000 1908 1452 471 -1230 -3883 -7760 -13176 -20492
19 28 50 94 169 284 448 670 959 1324 1774 2318 2965 3724 4604 5614 6763 8060 9514 11134 12929
28 38 38 26 0 -38 -67 -3 415 1893 6173 17281 44065 105169 238456 518380 1087409 2212203 4383427 8492743 16147397
5 20 59 131 242 395 590 824 1091 1382 1685 1985 2264 2501 2672 2750 2705 2504 2111 1487 590
6 2 6 32 96 231 528 1216 2790 6189 13018 25801 48248 85520 144484 233967 365046 551452 810222 1162806 1636928
17 28 40 52 72 141 368 986 2458 5701 12583 27024 57355 121142 254594 530181 1088691 2196779 4350590 8465505 16231918
12 11 21 54 140 347 809 1765 3607 6925 12517 21289 33891 49823 65647 72001 49672 -33223 -216433 -518802 -849232
10 17 44 108 240 508 1058 2175 4363 8453 15785 28590 50844 90117 161363 294314 547409 1033610 1968447 3761345 7194253
5 5 19 72 199 445 877 1616 2893 5129 9035 15724 26823 44569 71869 112300 170021 249565 355475 491744 661015
-4 -2 -2 7 53 187 493 1102 2210 4100 7168 11953 19171 29753 44887 66064 95128 134330 186386 254539 342625
11 33 78 156 276 441 647 904 1306 2186 4401 9801 21945 47136 95856 184691 338845 595351 1007096 1647786 2617986
25 41 70 132 268 547 1081 2068 3889 7299 13789 26281 50508 97850 191284 377885 754712 1521183 3082460 6249315 12619309
-1 -1 -3 -10 -26 -62 -145 -325 -668 -1205 -1769 -1581 1690 13954 49005 137645 346876 819457 1852938 4051920 8610837
22 33 53 104 223 459 864 1482 2358 3629 5831 10670 22671 52347 121830 274288 588926 1203945 2350521 4401676 7940855
12 11 21 61 167 414 950 2038 4111 7861 14402 25565 44396 75932 128321 214326 353206 572895 912299 1423397 2172661
8 20 41 64 80 78 45 -34 -176 -400 -727 -1180 -1784 -2566 -3555 -4782 -6280 -8084 -10231 -12760 -15712
-2 6 27 66 145 326 753 1729 3852 8242 16899 33240 62871 114658 202169 345567 574042 928878 1467259 2266926 3431805
12 28 63 123 214 342 513 733 1008 1344 1747 2223 2778 3418 4149 4977 5908 6948 8103 9379 10782
6 26 62 131 265 524 1024 1993 3880 7558 14699 28483 54967 105724 202813 387811 737580 1390714 2590327 4751374 8565245
21 36 62 107 189 335 588 1045 1959 3948 8364 17885 37403 75291 145142 268083 475777 814236 1348578 2168871 3397217
5 4 13 36 73 128 229 462 1032 2399 5601 12970 29584 66034 143565 303669 626287 1264754 2512757 4930676 9578227
7 2 -7 -23 -46 -70 -74 14 426 1831 5961 16919 43793 105787 242259 532348 1133175 2353478 4793766 9609732 19002244
11 12 10 2 -6 30 237 898 2586 6423 14579 31231 64432 129820 258029 509351 1002068 1965542 3836675 7431044 14243609
0 12 39 99 221 455 901 1767 3469 6790 13116 24762 45399 80638 139043 234523 392817 668899 1191032 2265408 4610856
6 11 26 59 112 181 265 398 725 1650 4091 9884 22385 47326 93988 176761 317168 546437 908712 1465001 2297966
-2 -1 -2 -5 -10 -17 -26 -37 -50 -65 -82 -101 -122 -145 -170 -197 -226 -257 -290 -325 -362
23 36 64 124 242 471 926 1841 3650 7103 13476 25071 46516 88010 172830 353435 743825 1581207 3338918 6927765 14049890
14 21 26 22 -3 -66 -189 -399 -728 -1213 -1896 -2824 -4049 -5628 -7623 -10101 -13134 -16799 -21178 -26358 -32431
20 27 34 41 48 55 62 69 76 83 90 97 104 111 118 125 132 139 146 153 160
25 35 55 97 189 389 809 1671 3442 7132 14883 31017 63737 127709 247926 465970 852036 1532025 2753039 5041238 9569328
-8 -13 -18 -23 -28 -33 -38 -43 -48 -53 -58 -63 -68 -73 -78 -83 -88 -93 -98 -103 -108
16 28 55 120 260 532 1018 1842 3231 5681 10342 19835 39888 82462 171472 352836 711454 1398878 2676933 4984438 9036504
21 47 100 194 346 576 916 1439 2319 3945 7149 13683 27206 55232 112757 228640 456273 890651 1694658 3138232 5655074
0 -1 -4 2 51 208 588 1401 3038 6213 12176 23012 42041 74334 127360 211779 342396 539291 829140 1246742 1836767
-7 2 29 78 153 263 431 717 1280 2524 5398 11960 26413 57086 120486 249988 514640 1059062 2185338 4515096 9299438
-9 -13 -9 24 125 369 897 1964 4018 7824 14650 26566 47030 82242 144378 258964 480569 924009 1822761 3632772 7208891
7 3 1 10 46 132 305 649 1401 3220 7764 18791 44113 98962 211849 435192 865667 1685080 3244946 6243388 12093370
-3 6 40 115 248 453 734 1072 1404 1607 1549 1388 2562 10462 40878 134395 386683 1009100 2444674 5581361 12130176
17 31 57 95 145 207 281 367 465 575 697 831 977 1135 1305 1487 1681 1887 2105 2335 2577
17 35 63 100 138 167 202 346 912 2653 7213 18054 42398 95252 207535 442015 923751 1896979 3829455 7600644 14835558
17 20 23 43 119 324 797 1822 3998 8567 17997 36951 73795 142778 266934 481665 839132 1414723 2320520 3739768 6015952
24 36 48 60 72 84 96 108 120 132 144 156 168 180 192 204 216 228 240 252 264
25 36 58 102 179 300 476 718 1037 1444 1950 2566 3303 4172 5184 6350 7681 9188 10882 12774 14875
19 27 42 69 112 181 323 707 1818 4855 12500 30373 69807 153246 324893 671696 1364077 2733007 5411518 10586401 20432114
9 14 20 40 109 300 742 1640 3309 6260 11434 20803 38807 75602 154127 325095 698165 1505485 3228408 6844265 14295557
1 13 49 128 268 481 768 1114 1483 1813 2011 1948 1454 313 -1742 -5034 -9947 -16931 -26507 -39272 -55904
27 39 58 87 133 230 472 1061 2398 5291 11432 24414 51728 108408 223288 449208 878965 1669359 3076342 5505049 9579383
25 47 88 166 305 541 937 1623 2897 5453 10843 22330 46343 94795 188560 362411 671681 1200803 2073690 3465606 5615725
10 7 4 1 -2 -5 -8 -11 -14 -17 -20 -23 -26 -29 -32 -35 -38 -41 -44 -47 -50
7 0 -6 1 48 188 525 1278 2926 6508 14211 30477 64009 131268 262340 510426 966681 1782712 3203752 5616369 9615558
12 21 34 53 73 85 91 148 486 1794 5844 16732 43163 102400 226741 473689 941344 1790979 3279270 5803239 9961645
-6 1 11 32 84 196 401 743 1339 2584 5661 13657 33865 82406 193355 436439 950584 2005807 4114103 8222282 16037730
-2 1 3 7 33 130 402 1077 2676 6379 14748 33077 71833 150980 307503 608247 1171346 2201141 4043689 7272875 12820897
2 14 34 67 122 218 396 744 1462 3024 6534 14423 31694 67992 140856 280600 537370 991034 1764682 3042643 5094066
11 6 7 35 123 310 628 1087 1683 2487 3919 7370 16407 38881 90356 199388 415307 819292 1539679 2772605 4809267
-5 -9 -5 16 63 145 271 450 691 1003 1395 1876 2455 3141 3943 4870 5931 7135 8491 10008 11695
0 12 38 84 164 302 534 910 1496 2376 3654 5456 7932 11258 15638 21306 28528 37604 48870 62700 79508
11 21 30 41 57 81 116 169 284 664 1991 6116 17368 44822 105971 232366 477921 930727 1729380 3085003 5310331
10 40 97 190 321 489 715 1101 1936 3862 8113 16840 33535 63567 114843 198607 330390 531124 828433 1258114 1865821
12 28 61 130 259 479 829 1365 2200 3613 6281 11705 22919 45590 89637 171518 317356 567098 979925 1641156 2670915
15 33 54 71 77 68 46 22 19 75 246 609 1265 2342 3998 6424 9847 14533 20790 28971 39477
-10 -15 -20 -25 -30 -35 -40 -45 -50 -55 -60 -65 -70 -75 -80 -85 -90 -95 -100 -105 -110
16 24 40 68 112 176 264 380 528 712 936 1204 1520 1888 2312 2796 3344 3960 4648 5412 6256
14 25 37 46 54 74 127 236 434 829 1818 4623 12447 32735 81301 189486 416098 866725 1724199 3295640 6083768
-3 10 37 94 212 451 922 1828 3549 6813 13019 24813 47068 88488 164148 299401 535733 939332 1613361 2715192 4480172
12 13 24 54 105 167 213 194 34 -375 -1178 -2562 -4761 -8061 -12805 -19398 -28312 -40091 -55356 -74810 -99243
13 22 45 88 157 258 397 580 813 1102 1453 1872 2365 2938 3597 4348 5197 6150 7213 8392 9693
10 36 82 151 244 363 514 710 974 1342 1866 2617 3688 5197 7290 10144 13970 19016 25570 33963 44572
4 2 -4 -8 3 49 157 361 702 1228 1994 3062 4501 6387 8803 11839 15592 20166 25672 32228 39959
5 14 31 52 73 90 99 96 77 38 -25 -116 -239 -398 -597 -840 -1131 -1474 -1873 -2332 -2855
-6 -12 -12 12 88 251 542 1028 1886 3631 7621 17044 38686 85898 183327 374154 730794 1370262 2475698 4325876 7334900
11 28 64 138 279 526 930 1566 2563 4167 6888 11886 21983 44133 94954 212172 476731 1053110 2259328 4683530 9371303
3 23 67 145 267 443 683 997 1395 1887 2483 3193 4027 4995 6107 7373 8803 10407 12195 14177 16363
0 9 33 79 157 294 551 1042 1956 3579 6313 10715 17660 28896 48522 86272 163876 326077 657909 1309271 2526211
17 37 65 103 168 309 627 1306 2675 5350 10574 21028 42710 89106 190006 409227 878565 1859987 3854991 7789941 15319908
16 32 56 95 171 323 613 1144 2092 3746 6543 11082 18105 28447 42984 62651 88664 123164 170610 240385 351247
20 48 91 149 222 310 413 531 664 812 975 1153 1346 1554 1777 2015 2268 2536 2819 3117 3430
-7 -7 8 51 145 330 666 1236 2168 3721 6521 12093 23918 49354 102901 211466 422499 816129 1522734 2747735 4805815
8 15 32 77 191 461 1061 2324 4860 9735 18724 34647 61791 106413 177309 286422 449448 686383 1021936 1485713 2112055
-3 10 45 119 251 464 795 1309 2110 3349 5253 8249 13360 23283 45099 96754 221868 521974 1223292 2808615 6267122
-7 5 37 105 246 529 1066 2023 3631 6197 10115 15877 24084 35457 50848 71251 97813 131845 174833 228449 294562
12 39 77 138 261 529 1087 2164 4111 7491 13302 23496 42117 77700 148187 290731 580666 1167011 2336655 4626474 9012841
8 12 15 31 99 298 761 1693 3420 6526 12168 22686 42639 80409 150574 277483 501112 887748 1550973 2693733 4691283
18 42 80 144 252 424 678 1026 1470 1998 2580 3164 3672 3996 3994 3486 2250 18 -3528 -8760 -16108
5 11 27 67 145 275 471 747 1117 1595 2195 2931 3817 4867 6095 7515 9141 10987 13067 15395 17985
7 2 -2 2 40 171 511 1273 2832 5832 11359 21213 38345 67630 117402 202691 352013 621034 1118636 2054040 3817862
-4 -2 4 20 54 113 208 371 686 1334 2653 5231 10110 19325 37293 74076 152352 321126 680882 1427086 2921742
18 44 88 156 253 390 602 977 1692 3048 5492 9610 16071 25498 38238 53999 71318 86820 94224 83048 36961
8 16 49 124 268 524 953 1628 2615 3934 5489 6949 7552 5807 -841 -15926 -41810 -70848 -58719 144294 952600
5 21 47 79 128 249 599 1535 3764 8565 18133 36179 69109 128471 236007 433767 803764 1505609 2848844 5434347 10436151
17 32 47 62 77 92 107 122 137 152 167 182 197 212 227 242 257 272 287 302 317
3 22 64 144 282 503 837 1319 1989 2892 4078 5602 7524 9909 12827 16353 20567 25554 31404 38212 46078
30 40 54 87 160 300 540 919 1482 2280 3370 4815 6684 9052 12000 15615 19990 25224 31422 38695 47160
16 32 59 89 121 168 260 443 774 1312 2105 3173 4487 5944 7338 8327 8396 6816 2599 -5551 -19291
14 28 47 76 120 184 273 392 546 740 979 1268 1612 2016 2485 3024 3638 4332 5111 5980 6944
2 5 27 95 262 618 1301 2508 4506 7643 12359 19197 28814 41992 59649 82850 112818 150945 198803 258155 330966
22 49 91 166 310 592 1145 2225 4330 8443 16507 32296 62914 121234 229681 425867 770702 1359733 2338603 3923674 6429022
10 21 45 109 249 508 944 1665 2916 5250 9830 18964 37136 73179 145043 290217 588027 1206379 2498594 5203369 10858160
-1 1 17 60 160 375 802 1588 2941 5141 8551 13628 20934 31147 45072 63652 87979 119305 159053 208828 270428
-8 -11 -14 -17 -20 -23 -26 -29 -32 -35 -38 -41 -44 -47 -50 -53 -56 -59 -62 -65 -68
18 23 36 76 172 359 680 1216 2177 4095 8160 16722 33931 66383 123458 216746 357524 550631 782244 997936 1065942
0 -4 -3 25 123 366 874 1827 3482 6192 10427 16797 26077 39234 57456 82183 115140 158372 214281 285665 375759
4 16 40 98 233 524 1106 2204 4205 7808 14308 26091 47465 86092 155675 281515 512676 948785 1797624 3494503 6941039
-5 -13 -24 -38 -55 -75 -98 -124 -153 -185 -220 -258 -299 -343 -390 -440 -493 -549 -608 -670 -735
10 1 -9 -12 19 157 569 1592 3851 8448 17274 33527 62558 113214 199902 345661 586600 978139 1603577 2585606 4101493
1 3 17 69 207 524 1194 2535 5141 10166 19909 38969 76469 150297 295195 578257 1128729 2195245 4254933 8218565 15809219
10 22 48 96 169 271 424 707 1340 2867 6558 15276 35279 79804 175904 377088 786347 1598271 3177560 6209020 11990048
5 15 36 85 194 423 896 1878 3911 8022 16006 30782 56860 101154 174990 299719 521833 950577 1844464 3797003 8112502
21 33 50 83 165 369 828 1761 3525 6751 12708 24207 47648 97279 203454 427794 890020 1814735 3613832 7036842 13459348
14 17 16 14 33 141 492 1393 3430 7709 16306 33086 65160 125416 236811 439513 802698 1444181 2563736 4501038 7838391
10 16 31 69 144 270 461 731 1094 1564 2155 2881 3756 4794 6009 7415 9026 10856 12919 15229 17800
7 9 12 19 42 122 363 991 2458 5621 12043 24497 47820 90394 166798 302736 544530 977975 1766715 3231869 6019627
4 0 -9 -12 9 73 190 343 468 461 281 288 2091 10462 37444 110883 291604 706830 1612875 3508468 7332309
18 26 40 66 114 201 354 613 1034 1692 2684 4132 6186 9027 12870 17967 24610 33134 43920 57398 74050
15 27 58 121 236 442 810 1459 2589 4562 8090 14643 27294 52405 102870 204119 404811 795173 1537354 2914045 5404064
11 10 8 5 -4 -20 -8 168 848 2712 6927 15261 30118 54560 92871 153714 261793 492858 1065910 2564441 6430408
15 25 51 112 246 534 1141 2384 4839 9499 17996 32919 58337 100843 171899 293232 509042 913000 1706876 3325965 6703263
-1 9 32 68 115 169 224 272 303 305 264 164 -13 -287 -680 -1216 -1921 -2823 -3952 -5340 -7021
-1 12 45 116 255 509 955 1730 3100 5615 10445 20077 39695 79811 161196 324214 647071 1282904 2537279 5031484 10043393
5 7 17 37 80 186 452 1095 2586 5929 13213 28635 60273 122972 242782 463441 855411 1527931 2644425 4441369 7250350
7 23 63 136 261 492 967 2003 4266 9050 18705 37264 71336 131359 233347 401321 670689 1092937 1742115 2723752 4187015
17 23 39 86 206 487 1102 2368 4835 9418 17586 31629 55062 93350 155464 257533 431499 745124 1346709 2561749 5095272
13 19 34 66 123 213 344 524 761 1063 1438 1894 2439 3081 3828 4688 5669 6779 8026 9418 10963
19 47 95 181 329 563 912 1447 2376 4232 8219 16853 35169 72975 148923 297522 580605 1105121 2049363 3699737 6499757
12 13 30 90 247 592 1274 2545 4842 8919 16042 28260 48765 82354 136006 219587 346696 535665 810726 1203358 1753827
19 25 44 96 216 475 1017 2121 4318 8627 17023 33316 64703 124351 235468 437403 794357 1407245 2429070 4083784 6687930
-1 5 27 77 186 418 884 1756 3281 5795 9737 15663 24260 36360 52954 75206 104467 142289 190439 250913 325950
6 10 19 38 71 116 164 213 317 716 2159 6665 19190 50999 126010 292065 640208 1337090 2679499 5187348 9764889
28 38 49 68 106 194 419 998 2423 5732 13002 28239 58983 119186 234298 450057 847278 1566034 2844087 5076334 8904464
6 13 18 21 22 21 18 13 6 -3 -14 -27 -42 -59 -78 -99 -122 -147 -174 -203 -234
22 37 53 70 88 107 127 148 170 193 217 242 268 295 323 352 382 413 445 478 512
5 13 28 52 84 133 243 530 1231 2765 5806 11368 20902 36405 60541 96774 149513 224269 327824 468412 655912
18 33 64 135 292 616 1242 2390 4418 7917 13887 24064 41514 71674 124105 215331 373274 643961 1101378 1861581 3102448
4 3 11 47 144 355 768 1552 3075 6166 12643 26309 54757 112604 227395 450843 881296 1710389 3321733 6499619 12864200
-5 -6 -4 1 9 20 34 51 71 94 120 149 181 216 254 295 339 386 436 489 545
15 21 33 54 88 153 300 637 1357 2769 5331 9684 16686 27445 43350 66099 97723 140605 197493 271506 366132
13 35 75 150 291 559 1080 2117 4210 8428 16790 32925 63054 117390 212065 371706 632795 1047961 1691365 2665352 4108557
8 4 -5 -7 28 149 415 875 1537 2338 3176 4192 6756 16115 47584 139866 382350 969773 2311243 5249518 11507696
22 44 86 158 264 394 520 617 737 1177 2818 7809 21017 53244 128459 299776 683577 1529631 3360043 7236153 15258355
1 16 58 146 311 606 1131 2087 3877 7276 13696 25576 46931 84098 146721 249021 411401 662440 1041334 1600846 2410831
0 -8 -18 -31 -37 -1 167 668 1904 4620 10147 20856 41033 78533 147776 274919 506384 922352 1657356 2930731 5090415
8 13 29 66 147 327 720 1540 3174 6330 12364 24032 47218 94802 195005 408709 864104 1823683 3809815 7833442 15799577
24 37 66 138 305 664 1396 2840 5623 10878 20619 38439 70902 130375 240667 447799 839626 1579987 2965704 5518232 10126239
9 12 25 57 123 264 586 1336 3045 6781 14581 30211 60632 119124 232314 456039 910197 1852428 3827933 7963859 16532197
1 1 3 8 18 36 66 113 183 283 421 606 848 1158 1548 2031 2621 3333 4183 5188 6366
8 6 5 20 77 210 453 821 1278 1712 1985 2217 3629 10567 34856 104568 280948 690174 1581737 3433954 7141669
10 30 73 157 315 611 1176 2293 4577 9315 19052 38532 76128 145922 270625 485558 843948 1423828 2336867 3739495 5846729
19 31 37 38 48 104 293 809 2052 4780 10324 20875 39851 72351 125702 210104 339377 531813 811135 1207564 1758994
22 35 53 86 163 339 697 1345 2408 4015 6281 9284 13037 17455 22317 27223 31546 34379 34477 30194 19415
-1 12 38 74 122 212 439 1017 2353 5151 10577 20550 38257 68990 121315 208324 348175 562138 866740 1254094 1650808
12 21 34 66 148 342 778 1725 3717 7769 15737 30900 58871 108978 196295 344547 590162 987797 1617724 2595526 4084622
10 17 38 80 160 308 564 975 1609 2624 4478 8470 18011 41433 97955 230071 529016 1186982 2604228 5608829 11906538
13 29 56 94 159 298 603 1229 2430 4640 8643 15909 29276 54467 103724 204643 421079 900583 1977702 4391236 9728713
10 9 11 16 24 35 49 66 86 109 135 164 196 231 269 310 354 401 451 504 560
16 32 48 66 95 157 295 595 1252 2746 6262 14612 34150 78637 176982 388789 835636 1763596 3666184 7520406 15227221
17 33 54 75 88 91 103 198 592 1840 5226 13480 32087 71760 153269 316913 640646 1273346 2493129 4805592 9105593
2 7 25 71 165 340 672 1350 2822 6092 13324 29067 62704 133229 278288 570754 1148182 2263637 4371047 8264983 15304355
12 23 45 91 196 430 914 1848 3573 6715 12509 23486 44837 86956 169920 330999 636714 1201487 2215565 3985661 6992650
17 23 30 39 47 47 28 -25 -131 -313 -598 -1017 -1605 -2401 -3448 -4793 -6487 -8585 -11146 -14233 -17913
19 31 63 128 244 443 784 1379 2455 4494 8521 16662 33202 66592 133268 264873 521675 1016857 1959179 3725596 6981144
8 17 46 97 170 276 468 903 1962 4479 10171 22442 47908 99367 201748 404302 805948 1608225 3225376 6510111 13207278
12 24 54 125 279 582 1128 2038 3446 5473 8240 12114 18702 33734 74085 183016 460572 1120346 2589974 5681335 11868165
9 11 24 62 146 317 662 1357 2732 5376 10339 19580 37005 70822 138651 278095 567675 1166753 2389242 4835946 9626380
-1 8 38 94 191 380 785 1651 3403 6716 12596 22472 38299 62672 98951 151397 225319 327232 465026 648146 887783
-1 -2 -10 -28 -59 -106 -172 -260 -373 -514 -686 -892 -1135 -1418 -1744 -2116 -2537 -3010 -3538 -4124 -4771
8 21 49 111 227 425 775 1468 2961 6212 13032 26584 52062 97586 175352 303079 505798 818031 1286411 1972797 2957941
2 7 23 51 90 138 205 349 747 1824 4504 10759 24896 56590 127806 287878 644787 1427159 3102514 6596251 13689393
7 26 69 160 347 720 1448 2847 5484 10323 18938 33869 59304 102485 176692 307706 548167 1010270 1941209 3896660 8132539
8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 113 120 127 134 141 148

View File

@ -7,6 +7,7 @@ mod day05;
mod day06; mod day06;
mod day07; mod day07;
mod day08; mod day08;
mod day09;
const CONTENT01: &'static str = include_str!("input/day01/input.txt"); const CONTENT01: &'static str = include_str!("input/day01/input.txt");
const CONTENT02: &'static str = include_str!("input/day02/input.txt"); const CONTENT02: &'static str = include_str!("input/day02/input.txt");
@ -16,6 +17,7 @@ const CONTENT05: &'static str = include_str!("input/day05/input.txt");
const CONTENT06: &'static str = include_str!("input/day06/input.txt"); const CONTENT06: &'static str = include_str!("input/day06/input.txt");
const CONTENT07: &'static str = include_str!("input/day07/input.txt"); const CONTENT07: &'static str = include_str!("input/day07/input.txt");
const CONTENT08: &'static str = include_str!("input/day08/input.txt"); const CONTENT08: &'static str = include_str!("input/day08/input.txt");
const CONTENT09: &'static str = include_str!("input/day09/input.txt");
fn main() { fn main() {
day01::execute_task01(CONTENT01); day01::execute_task01(CONTENT01);
@ -41,4 +43,7 @@ fn main() {
println!(); println!();
day08::execute_task01(CONTENT08); day08::execute_task01(CONTENT08);
day08::execute_task02(CONTENT08); day08::execute_task02(CONTENT08);
println!();
day09::execute_task01(CONTENT09);
day09::execute_task02(CONTENT09);
} }