답안 #17846

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17846 2016-01-12T13:26:31 Z Elibay 홀-짝 수열 (IZhO11_oddeven) C++14
45.45 / 100
0 ms 1716 KB
#include <bits/stdc++.h>

using namespace std;

unsigned long long n, l = 0, r = 1e18 + 1, x, w;

int main ()
{
    #ifdef Elibay
        freopen (".in", "r", stdin);
    #endif
    cin >> n;
    while (l <= r)
    {
        unsigned long long m = (l + r) >> 1;
        if (m * (m + 1) / 2 < n)
            l = m + 1, w = m;
        else
            r = m - 1;
    }
    l = w;
    x = l * (l + 1) / 2 + l * (l - 1) / 2 + 1;
    n = n - (l * (l + 1)) / 2;
    cout << x + n + n - 2;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1716 KB Output is correct
2 Correct 0 ms 1716 KB Output is correct
3 Correct 0 ms 1716 KB Output is correct
4 Correct 0 ms 1716 KB Output is correct
5 Correct 0 ms 1716 KB Output is correct
6 Correct 0 ms 1716 KB Output is correct
7 Correct 0 ms 1716 KB Output is correct
8 Correct 0 ms 1716 KB Output is correct
9 Correct 0 ms 1716 KB Output is correct
10 Correct 0 ms 1716 KB Output is correct
11 Incorrect 0 ms 1716 KB Output isn't correct
12 Incorrect 0 ms 1716 KB Output isn't correct
13 Incorrect 0 ms 1716 KB Output isn't correct
14 Incorrect 0 ms 1716 KB Output isn't correct
15 Incorrect 0 ms 1716 KB Output isn't correct
16 Incorrect 0 ms 1716 KB Output isn't correct
17 Incorrect 0 ms 1716 KB Output isn't correct
18 Incorrect 0 ms 1716 KB Output isn't correct
19 Incorrect 0 ms 1716 KB Output isn't correct
20 Incorrect 0 ms 1716 KB Output isn't correct
21 Incorrect 0 ms 1716 KB Output isn't correct
22 Incorrect 0 ms 1716 KB Output isn't correct