# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523239 | redstonegamer22 | Odd-even (IZhO11_oddeven) | Cpython 3 | 13 ms | 2828 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())
m = math.isqrt(2 * n) - 5
while m <= 0 or (m + 1) * (m + 2) // 2 <= n:
m = m + 1
# print(m)
a = m * (m + 1) // 2 + m * (m - 1) // 2
b = n - m * (m + 1) // 2
ans = a + 2 * b - 1
print(ans)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |