Submission #524615

#TimeUsernameProblemLanguageResultExecution timeMemory
524615lukameladzeOdd-even (IZhO11_oddeven)C++14
0 / 100
1 ms332 KiB
# include <bits/stdc++.h> #define f first #define s second #define pb push_back #define int long long using namespace std; const int N = 3e5 + 5; int raod,cur,n,le,ri,ans,lef,rem; main() { cin>>n; le = 0; ri = 1e10; while (le <= ri) { int mid = (le + ri) / 2; if ((mid*(mid + 1))/2 < n) { ans = mid; le = mid + 1; } else ri = mid - 1; } lef = ans*ans+1; rem = n - (ans*(ans + 1))/2; cout<<lef + (rem - 1)*2<<endl; }

Compilation message (stderr)

oddeven.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...