Accepted
Code
#include<bits/stdc++.h>
using namespace std;
int main() {
int x,ans=0,rem=0;
cin>>x;
ans+=x;
rem=x;
for(int i=0;;i++){
ans+=(rem/2);
if (rem==1 || rem==0){
break;
}
rem+=(rem%2);
rem=rem/2;
}
cout<<ans<<endl;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1176 Free chocolate
- Contest
- Intra LU IEEE Beginner Programming Contest
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-02-26 06:23:35
- Judged At
- 2025-02-26 06:23:35
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB