You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
814 B

#!/usr/bin/env python3
import sys, re
if __name__ == '__main__':
lines = [line.strip('\n') for line in open(sys.argv[1])]
times = [int(n) for n in re.findall(r'\d+', lines[0])]
records = [int(n) for n in re.findall(r'\d+', lines[1])]
# challenge 1
res1 = 1
for i in range(len(times)):
count = 0
for t in range(times[i]):
if t * (times[i] - t) > records[i]: count += 1
res1 *= count
res1 = str(res1)
print(f"challenge 1:\n{res1}\n")
# challenge 2
time = int(''.join([str(i) for i in times]))
record = int(''.join([str(i) for i in records]))
res2 = 0
for t in range(time):
if t * (time - t) > record:
mint = t
break
res2 = str(time - 2 * mint + 1)
print(f"challenge 2:\n{res2}\n")