diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2023-12-06 21:18:10 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2023-12-06 21:18:10 +0100 |
commit | 8fc3cbbc7e2b5c91e739bc915068c737a736d2f4 (patch) | |
tree | 3ae1796e3b2a545fc7e8c57e088271c06af97883 /prog | |
parent | DN06 etc (diff) | |
download | r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar.gz r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar.bz2 r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar.lz r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar.xz r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.tar.zst r-8fc3cbbc7e2b5c91e739bc915068c737a736d2f4.zip |
Diffstat (limited to 'prog')
-rwxr-xr-x | prog/aoc/23/6/1.py | 32 | ||||
-rw-r--r-- | prog/aoc/23/6/in.txt | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/prog/aoc/23/6/1.py b/prog/aoc/23/6/1.py new file mode 100755 index 0000000..1539b09 --- /dev/null +++ b/prog/aoc/23/6/1.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 +timestr = input().split(":")[1] +time = timestr.split(" ") +try: + while True: + time.remove("") +except: + pass +time = [x for x in map(int, time)] +distancestr = input().split(":")[1] +distance = distancestr.split(" ") +try: + while True: + distance.remove("") +except: + pass +distance = [x for x in map(int, distance)] +product = 1 +for i in range(len(time)): + ways = 0 + for j in range(time[i]): + if (time[i]-j)*j > distance[i]: + ways += 1 + product *= ways +print(product) +ways = 0 +t = int(timestr.replace(" ", "")) +d = int(distancestr.replace(" ", "")) +for j in range(t): + if (t-j)*j > d: + ways += 1 +print(ways) diff --git a/prog/aoc/23/6/in.txt b/prog/aoc/23/6/in.txt new file mode 100644 index 0000000..28f5ae9 --- /dev/null +++ b/prog/aoc/23/6/in.txt @@ -0,0 +1,2 @@ +Time: 7 15 30 +Distance: 9 40 200 |