# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
884542 | kokoue | Odd-even (IZhO11_oddeven) | C++14 | 2 ms | 708 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;
unsigned long long n;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n;
int cnt2=0;
int sum=1;
while(n>1)
{
// cout<<"in with n="<<n<<", sum="<<sum<<", cnt2="<<cnt2<<"\n";
if(n>cnt2+1) sum+=1+cnt2*2;
else sum+=(n-1)*2;
cnt2++;
if(n<=cnt2) break;
n-=cnt2;
}
cout<<sum<<"\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |