Submission #885970

#TimeUsernameProblemLanguageResultExecution timeMemory
885970karimovOdd-even (IZhO11_oddeven)C++17
0 / 100
1 ms388 KiB
#include <bits/stdc++.h> using namespace std; void solve() { double n;cin>>n; int x = 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...