发现如果要凑(n)的钱,如果凑齐了(ulcorner n/2 urcorner)以下钱再来一个(llcorner n/2 lrcorner)就行了。
这样我们就可以分治了。。
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long long m;
int tot;
void print(long long now) {
if(!now) {printf("%d
",tot);return;}
tot++;
print(now>>1);
printf("%lld ",(now+1)>>1);
}
int main() {
cin>>m;
print(m);
return 0;
}