# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
885968 | karimov | Odd-even (IZhO11_oddeven) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
void solve() {
double n;cin>>n;
int x = ceil((ceil(sqrt(n*8+1))-1)/2);
if(x%2==1){
int d = (x+1)/2-1;
x--;
cout << (d*d*4+1)+(2*(n-(x*(x+1)/2)-1));
} else {
int d = x/2-1;
x--;
cout << (d*d*4+4*d+2)+(2*(n-(x*(x+1)/2)-1));
}
}
int main() {
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |