diff --git a/2022/d25/ex1/ex1.py b/2022/d25/ex1/ex1.py deleted file mode 100755 index 59686b9..0000000 --- a/2022/d25/ex1/ex1.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python - -import sys - - -def solve(input: list[str]) -> str: - def from_snafu(input: str) -> int: - res = 0 - for c in input: - if c == "=": - n = -2 - elif c == "-": - n = -1 - else: - n = int(c) - res = res * 5 + n - return res - - def to_snafu(input: int) -> str: - # Base case - if not input: - return "0" - - DIGITS = { - 2: "2", - 1: "1", - 0: "0", - -1: "-", - -2: "=", - } - - digits: list[int] = [] - while input: - input, d = divmod(input, 5) - if d not in DIGITS: - d -= 5 - input += 1 - digits.append(d) - return "".join(DIGITS[c] for c in reversed(digits)) - - return to_snafu(sum(map(from_snafu, input))) - - -def main() -> None: - input = sys.stdin.read().splitlines() - print(solve(input)) - - -if __name__ == "__main__": - main() diff --git a/2022/d25/ex1/input b/2022/d25/ex1/input deleted file mode 100644 index 0f32655..0000000 --- a/2022/d25/ex1/input +++ /dev/null @@ -1,125 +0,0 @@ -2112 -1=210=2 -1---22==12012-2=2= -1=1 -21=-0 -2-2=02-11== -210=- -202=11=-=12-2= -1-=01-=-1=- -1==1=20=1=12-0=2-2 -10==0==222=-1 -1100-20-= -1=0==01-0=-1-00-201= -100=-222 -21--20-==01-01-022 -2100-1=2-==11 -1=-0=21=2=1112102- -2==02220200=-100 -1= -1=12----0==121 -221=== -10--21-21-2010 -120-000122-20122-= -1-2=01020-=--2 -100-0-12=0101=1==2 -220=-2-011-=12=0 -1=-=0022000-2==- -10=-01 -1-00-02122000=- -1===000=0 -1111 -122--=-0-2--001=0 -1==020--22 -1020-=2-1-1=010=0 -1=-=-=02-= -2-10211-1===1 -1-12-=1-11-2002 -10110- -11=1=0- -12- -102-2=22=2-=-022 -1=-2-0=2--= -2=21=2=0-= -2=-2212= -1=-110222=-1-2==-1 -11122 -1=- -2=01-1=- -1=2=10-202==0===-0= -2--- -1===20=--1 -1-==--1==-2-1=-2=0 -10=-= -1-1=2= -110 -121==0 -22000=20= -1-1=-0-2 -20-2-21=0022-22100 -1=010-=21-=12-1 -22021000222 -10=20=2-111 -12--20=2-20 -100-==2-=10=2-1- -1120012 -1=1202---01-1201= -200 -100=0 -1=10=01-2-=20=01= -1-=--22 -1-0121-==10 -110=1-1 -2-210-=0=10=1- -111-=0-=0=2--- -1=1210==1=-1=11-- -10-01222=011=0=0= -2120 -12-11-=212 -1==11-2-210----2 -12 -2012=-100-02-0-121- -11-2021220-=0 -12-0-00-222 -21-1==22021- -20-0 -1011-=1-10-= -2-00-0 -20-2=1 -1102-=1-==211 -1102-2 -21= -10100-1-1 -1=2-1-0 -1--2===0 -1-=01=2=- -10-1=-202==01-1 -1-01112=2010=-=101 -211==0-0===0==1- -1==220 -1-=1= -1-0110-12 -21-== -21202011--0- -2-2 -2= -200-=-2--1102100-0 -1-00=2-12 -1=-0--=-220212 -1-=210-= -12110-00212--= -20=1 -21=2=0=00 -1=22--=2==20-= -111-1-0211-=000=01 -2-12 -10-2-120===22 -21-00 -1=2 -1-=2- -1=-2--100202-= -2=101122 -11=21----1-- -1--- -12-12 -1=2=0--01=---212 diff --git a/2022/d25/ex2/ex2.py b/2022/d25/ex2/ex2.py deleted file mode 100755 index 918e0ec..0000000 --- a/2022/d25/ex2/ex2.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - - -def main() -> None: - print("There is no part two...") - - -if __name__ == "__main__": - main() diff --git a/2022/d25/ex2/input b/2022/d25/ex2/input deleted file mode 100644 index 0f32655..0000000 --- a/2022/d25/ex2/input +++ /dev/null @@ -1,125 +0,0 @@ -2112 -1=210=2 -1---22==12012-2=2= -1=1 -21=-0 -2-2=02-11== -210=- -202=11=-=12-2= -1-=01-=-1=- -1==1=20=1=12-0=2-2 -10==0==222=-1 -1100-20-= -1=0==01-0=-1-00-201= -100=-222 -21--20-==01-01-022 -2100-1=2-==11 -1=-0=21=2=1112102- -2==02220200=-100 -1= -1=12----0==121 -221=== -10--21-21-2010 -120-000122-20122-= -1-2=01020-=--2 -100-0-12=0101=1==2 -220=-2-011-=12=0 -1=-=0022000-2==- -10=-01 -1-00-02122000=- -1===000=0 -1111 -122--=-0-2--001=0 -1==020--22 -1020-=2-1-1=010=0 -1=-=-=02-= -2-10211-1===1 -1-12-=1-11-2002 -10110- -11=1=0- -12- -102-2=22=2-=-022 -1=-2-0=2--= -2=21=2=0-= -2=-2212= -1=-110222=-1-2==-1 -11122 -1=- -2=01-1=- -1=2=10-202==0===-0= -2--- -1===20=--1 -1-==--1==-2-1=-2=0 -10=-= -1-1=2= -110 -121==0 -22000=20= -1-1=-0-2 -20-2-21=0022-22100 -1=010-=21-=12-1 -22021000222 -10=20=2-111 -12--20=2-20 -100-==2-=10=2-1- -1120012 -1=1202---01-1201= -200 -100=0 -1=10=01-2-=20=01= -1-=--22 -1-0121-==10 -110=1-1 -2-210-=0=10=1- -111-=0-=0=2--- -1=1210==1=-1=11-- -10-01222=011=0=0= -2120 -12-11-=212 -1==11-2-210----2 -12 -2012=-100-02-0-121- -11-2021220-=0 -12-0-00-222 -21-1==22021- -20-0 -1011-=1-10-= -2-00-0 -20-2=1 -1102-=1-==211 -1102-2 -21= -10100-1-1 -1=2-1-0 -1--2===0 -1-=01=2=- -10-1=-202==01-1 -1-01112=2010=-=101 -211==0-0===0==1- -1==220 -1-=1= -1-0110-12 -21-== -21202011--0- -2-2 -2= -200-=-2--1102100-0 -1-00=2-12 -1=-0--=-220212 -1-=210-= -12110-00212--= -20=1 -21=2=0=00 -1=22--=2==20-= -111-1-0211-=000=01 -2-12 -10-2-120===22 -21-00 -1=2 -1-=2- -1=-2--100202-= -2=101122 -11=21----1-- -1--- -12-12 -1=2=0--01=---212