# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1045622 | ezzzay | Odd-even (IZhO11_oddeven) | C++14 | 0 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())
typedef long long ll;
using namespace std;
const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(2e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;
ll n, l = 0, r = INF, ans;
ll calc(ll x) {return (x) * (x + 1) / 2ll;}
int main () {
ios_base :: sync_with_stdio (false); cin.tie(0);
//freopen(fname".in", "r", stdin);
//freopen(fname".out", "w", stdout);
scanf("%lld", &n);
while (r - l > 1) {
ll mid = (r + l) / 2ll;
if (calc(mid) >= n)
r = mid;
else
l = mid;
}
ans = n + (n - l - 1);
printf("%lld", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |