luogu_2320 [HNOI2006]鬼谷子的钱袋

#include <cstdio>
#include <iostream>
using namespace std;
int m,cnt,a[1000000];

int main(){
    scanf("%d",&m);
    while(m>0){
        a[++cnt]=(m+1)>>1;
        m>>=1;
    }
    printf("%d\n",cnt);
    for(int i=cnt;i;i--)printf("%d ",a[i]);
    puts("");
    return 0;
}

  

posted @ 2017-10-16 13:29  wqtnb_tql_qwq_%%%  阅读(119)  评论(0编辑  收藏  举报