# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337868 | talant117408 | Odd-even (IZhO11_oddeven) | Cpython 3 | 18 ms | 3052 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
import math
n = input()
n = int(n)
def calc(x):
return x*(x+1)//2
l = 1
r = 1e51
while l < r:
mid = int((l+r+1)//2)
if calc(mid) <= int(n):
l = mid
else:
r = mid-1
l = int(l)
if calc(l) == n:
print(int(int(n*2)-int(l)))
else:
print(int(int(n*2)-int(l)-1))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |