You are viewing a single comment's thread. Return to all comments →
Python 3: ans: 1~left root + right root ~n-1
def solve(n, k): if 4*k>=n: return n-1 x1=(n-math.sqrt(n**2-4*n*k))/2 x2=(n+math.sqrt(n**2-4*n*k))/2 return math.floor(x1)+n-math.ceil(x2)
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Counting
You are viewing a single comment's thread. Return to all comments →
Python 3: ans: 1~left root + right root ~n-1