repl.it
@pieromqwerty/

Advent of Code Challenges

Python

No description

fork
loading
Files
  • main.py
  • day1_0.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import math

datanew = [39663, 21250, 41655, 47263, 37141, 17843, 16838, 47993, 20887, 25837, 20052, 24230, 41046, 19229, 29044, 27608, 17761, 20034, 38551, 17070, 39258, 27183, 34652, 29664, 36441, 33493, 45518, 48338, 46849, 34139, 31109, 25086, 18586, 23362, 24598, 27114, 47016, 18811, 47230, 29846, 35382, 32889, 33625, 45975, 29334, 49673, 30920, 37911, 26655, 28578, 42208, 25206,41678, 23077, 49021, 20260, 21248, 48119, 27289, 35741, 30261, 27216, 47999, 24843, 42223, 49154, 41117, 22691, 45472, 31541, 19419, 40804, 47975, 49507, 43038, 26128, 24761, 35596, 47878, 19700, 21485, 26070, 18702, 21567, 27455, 38408, 24741, 43657, 27861, 25553, 31050, 46148, 23690, 42680, 21823, 28599, 48562, 35610, 23336, 37717]

x = 0
total = 0
while (x < 100):
    cur = datanew[x]
    while (cur > 2):
        temp = math.floor(cur/3)
        temp = temp - 2
        total = total + temp
        cur = temp
    print("Final weight for data point " + str(x) + " is " + str(temp) + ".")
    x = x + 1

print(total)