Submission #885963

# Submission time Handle Problem Language Result Execution time Memory
885963 2023-12-11T08:52:57 Z karimov Odd-even (IZhO11_oddeven) PyPy 3
0 / 100
26 ms 18236 KB
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
1 Incorrect 26 ms 18236 KB Output isn't correct
2 Halted 0 ms 0 KB -