답안 #1019654

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019654 2024-07-11T06:36:52 Z Minbaev 홀-짝 수열 (IZhO11_oddeven) PyPy 3
0 / 100
46 ms 20148 KB
  n = int(input())

  l = 1
  r = 1e51
  ans = -1
  while l <= r:
    mid = (l + r) // 2

    sum = mid * (mid + 1) // 2
    if sum >= n:
      ans = mid
      r = mid - 1
    else:
      l = mid + 1

  # Correct calculation for 'val'
  val = (ans * (ans + 1) // 2 - n) * 2 + (ans - 1)

  print(val)

Compilation message

Sorry: IndentationError: unexpected indent (oddeven.py, line 1)
# 결과 실행 시간 메모리 Grader output
1 Runtime error 46 ms 20148 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -