답안 #523348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
523348 2022-02-07T14:09:42 Z Pety 홀-짝 수열 (IZhO11_oddeven) Python 3
100 / 100
20 ms 2836 KB
# Online Python - IDE, Editor, Compiler, Interpreter



N = int(input())

st = 1; dr = pow(10, 50);
ans = 0;
while st <= dr:
    mij = (st + dr) // 2
    if mij * (mij+1) // 2 >= N:
        ans = mij;
        dr = mij - 1;
    else:
        st = mij + 1;
if ans % 2 == 1:
    print(2 * (N - ans // 2 - 1) + 1)
else:
    print(2 * (N - ans // 2));
    
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2764 KB Output is correct
2 Correct 13 ms 2708 KB Output is correct
3 Correct 14 ms 2792 KB Output is correct
4 Correct 13 ms 2832 KB Output is correct
5 Correct 14 ms 2836 KB Output is correct
6 Correct 14 ms 2748 KB Output is correct
7 Correct 18 ms 2832 KB Output is correct
8 Correct 20 ms 2764 KB Output is correct
9 Correct 14 ms 2764 KB Output is correct
10 Correct 13 ms 2828 KB Output is correct
11 Correct 13 ms 2724 KB Output is correct
12 Correct 13 ms 2828 KB Output is correct
13 Correct 13 ms 2816 KB Output is correct
14 Correct 13 ms 2820 KB Output is correct
15 Correct 13 ms 2796 KB Output is correct
16 Correct 12 ms 2764 KB Output is correct
17 Correct 19 ms 2768 KB Output is correct
18 Correct 13 ms 2828 KB Output is correct
19 Correct 13 ms 2764 KB Output is correct
20 Correct 13 ms 2828 KB Output is correct
21 Correct 13 ms 2764 KB Output is correct
22 Correct 13 ms 2736 KB Output is correct