18 lines
358 B
Python
18 lines
358 B
Python
#!/usr/bin/env python3
|
|
import math
|
|
import re
|
|
|
|
lines = (x.strip() for x in open("input.txt"))
|
|
t = 0
|
|
r = 0
|
|
|
|
for line in lines:
|
|
if line.startswith("Time"):
|
|
t = int(re.sub("[^\d]", "", line))
|
|
else:
|
|
r = int(re.sub("[^\d]", "", line))
|
|
|
|
pmin = (t-(t**2-4*r)**0.5)/2
|
|
pmax = (t+(t**2-4*r)**0.5)/2
|
|
print(math.floor(pmax) - math.ceil(pmin) + 1)
|