水题,模拟
二进制分解这种意思。。。。
分成2 4 8 16.。。。。。
#include<cstdio>
using namespace std;
int n,tot;
int main(){
freopen("chocolate.in","r",stdin);
freopen("chocolate.out","w",stdout);
scanf("%d",&n);
while(n)
{
int ans=1,t=0;
while(ans*2<=n){
tot+=ans;
ans*=2;
}
n-=ans;
}
printf("%d",tot);
}