Percepts of
AtCoder 2 - 洛谷 | 计算机科学教育新生态
这个题有 1500 score \(\dots\) 得了
225,可以了,不用过于深入 \(\dots\)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| void solve() { ll x; cin >> x; bitset<64> a(x);
int idx = 63; for (int i = 63; i >= 0; i--) if (a[i]) { idx = i; break; } vector<int> ans(__lg(x) + 1, 0); for (int j = 1; j <= idx; j++) ans[j] = j; for (int i = idx - 1; i >= 0; i--) if (a[i]) ans.insert(ans.begin() + i + 1, ++idx);
cout << ans.size() - 1 << '\n'; for (int i = 1; i < ans.size(); i++) cout << ans[i] << " "; cout << "\n"; }
|