답안 #885960

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
885960 2023-12-11T08:50:37 Z karimov 홀-짝 수열 (IZhO11_oddeven) PyPy 3
0 / 100
27 ms 18440 KB
import math
n = float(input())
x = math.ceil((math.ceil(math.sqrt(8 * n + 1)) - 1) / 2)
if x % 2 == 1:
    d = (x + 1) // 2 - 1
    x -= 1
    result = (d ** 2 * 4 + 1) + (2 * (n - (x * (x + 1) // 2) - 1))
else:
    d = x // 2 - 1
    x -= 1
    result = (d ** 2 * 4 + 4 * d + 2) + (2 * (n - (x * (x + 1) // 2) - 1))
print(int(result))

# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 18228 KB Output is correct
2 Correct 27 ms 18396 KB Output is correct
3 Correct 27 ms 18228 KB Output is correct
4 Correct 27 ms 18440 KB Output is correct
5 Correct 27 ms 18236 KB Output is correct
6 Correct 27 ms 18372 KB Output is correct
7 Correct 27 ms 18228 KB Output is correct
8 Correct 27 ms 18236 KB Output is correct
9 Correct 27 ms 18236 KB Output is correct
10 Correct 27 ms 18228 KB Output is correct
11 Incorrect 27 ms 18236 KB Output isn't correct
12 Halted 0 ms 0 KB -