| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 17846 | Elibay | 홀-짝 수열 (IZhO11_oddeven) | C++14 | 0 ms | 1716 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
