# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885972 | karimov | Odd-even (IZhO11_oddeven) | Pypy 3 | 28 ms | 18360 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 = float(input())
x = math.ceil((math.ceil(math.sqrt(8 * n + 1)) - 1) / 2)
if x % 2 == 1:
d = (x + 1) // 2 - 1
x -= 1
result = (d ** 2 * 4 + 1) + (2 * (n - (x * (x + 1) // 2) - 1))
else:
d = x // 2 - 1
x -= 1
result = (d ** 2 * 4 + 4 * d + 2) + (2 * (n - (x * (x + 1) // 2) - 1))
print(int(result))
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |