Submission #676515

#TimeUsernameProblemLanguageResultExecution timeMemory
676515QwertyPiOdd-even (IZhO11_oddeven)Cpython 3
0 / 100
17 ms2844 KiB
from math import sqrt
n = int(input())

def isqrt(n):
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x


x = isqrt(n * 2)

while x * (x - 1) // 2 >= n:
    x -= 1
while x * (x + 1) / 2 < n:
    x += 1
print(n * 2 - x)
#Verdict Execution timeMemoryGrader output
Fetching results...