C++
$\color{gold}{— > 蓝桥杯辅导课题解}$
思路:
模拟
$签到题$
$时间复杂度:O(log_2n)$
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ll n; cin >> n;
while (n) {
cout << n << ' ';
n /= 2;
}
return 0;
}