AGC012C
请大佬看看这份代码有什么问题。
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 10;
int n, cnt1, cnt2, a[MAXN], b[MAXN], num = 101;
signed main()
{
cin >> n;
while (n >= 1) {
if (n & 1) a[++cnt1] = --num, n = (n - 1) / 2;
else b[++cnt2] = --num, n = n - 1;
}
cout << (100 - num + 1) * 2 << endl;
for (int i = 1; i <= cnt2; i++) cout << b[i] << " ";
for (int i = cnt1; i >= 1; i--) cout << a[i] << " ";
for (int i = num ;i <= 100; i++) cout << i << " ";
return 0;
}