generated from public/aoc_template
33 lines
691 B
Python
33 lines
691 B
Python
my_input = open("inputs/input2", "r").read().splitlines()
|
|
|
|
func_a_add = int(my_input[0].split(": ")[1].split()[-1])
|
|
func_b_mul = int(my_input[1].split(": ")[1].split()[-1])
|
|
func_c_pow = int(my_input[2].split(": ")[1].split()[-1])
|
|
|
|
|
|
def expo_price(price: int) -> int:
|
|
price **= func_c_pow
|
|
price *= func_b_mul
|
|
price += func_a_add
|
|
return price
|
|
|
|
|
|
my_input = list(sorted(map(int, my_input[4:])))
|
|
p1 = my_input[len(my_input)//2]
|
|
|
|
p2 = 0
|
|
for x in my_input:
|
|
if x % 2 == 0:
|
|
p2 += x
|
|
|
|
p3 = 0
|
|
p3_max = 15_000_000_000_000
|
|
for x in my_input:
|
|
price = expo_price(x)
|
|
if price > p3 and price <= p3_max:
|
|
p3 = x
|
|
|
|
print(expo_price(p1))
|
|
print(expo_price(p2))
|
|
print(p3)
|