# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885962 | karimov | Odd-even (IZhO11_oddeven) | Pypy 2 | 20 ms | 19516 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 = int(input())
def odd_even(n):
x = math.ceil((8 * n + 1) ** 0.5) // 2
d = x & 1
if d:
x -= 1
return (d ** 2 * 4 + 1) + (2 * (n - (x * (x + 1) // 2) - 1))
else:
x >>= 1
return (d ** 2 * 4 + 4 * d + 2) + (2 * (n - (x * (x + 1) // 2) - 1))
result = odd_even(n)
print(int(result))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |