답안 #676515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
676515 2022-12-31T06:02:28 Z QwertyPi 홀-짝 수열 (IZhO11_oddeven) Python 3
0 / 100
17 ms 2844 KB
from math import sqrt
n = int(input())

def isqrt(n):
    x = n
    y = (x + 1) // 2
    while y < x:
        x = y
        y = (x + n // x) // 2
    return x


x = isqrt(n * 2)

while x * (x - 1) // 2 >= n:
    x -= 1
while x * (x + 1) / 2 < n:
    x += 1
print(n * 2 - x)
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2772 KB Output is correct
2 Correct 12 ms 2772 KB Output is correct
3 Correct 13 ms 2804 KB Output is correct
4 Correct 12 ms 2844 KB Output is correct
5 Correct 13 ms 2760 KB Output is correct
6 Correct 13 ms 2824 KB Output is correct
7 Correct 15 ms 2780 KB Output is correct
8 Correct 13 ms 2804 KB Output is correct
9 Correct 14 ms 2812 KB Output is correct
10 Correct 17 ms 2764 KB Output is correct
11 Correct 13 ms 2780 KB Output is correct
12 Correct 17 ms 2736 KB Output is correct
13 Correct 16 ms 2720 KB Output is correct
14 Incorrect 14 ms 2772 KB Output isn't correct
15 Halted 0 ms 0 KB -