답안 #885964

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885964 2023-12-11T08:53:15 Z karimov 홀-짝 수열 (IZhO11_oddeven) Python 3
0 / 100
10 ms 2908 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))
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 2908 KB Output isn't correct
2 Halted 0 ms 0 KB -