Submission #885968

#TimeUsernameProblemLanguageResultExecution timeMemory
885968karimovOdd-even (IZhO11_oddeven)C++17
0 / 100
0 ms348 KiB
#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 timeMemoryGrader output
Fetching results...