第一条题解
2026-07-17 16:01:51
发布于:北京
2阅读
0回复
0点赞
第一条题解
第一条题解
#include<bits/stdc++.h>
using namespace std;
int main() {
int k, m;
cin >> k >> m;
priority_queue<int, vector<int>, greater<int>> q;
q.push(1);
vector<int> v;
while (v.size() < k) {
int c = q.top();
q.pop();
v.push_back(c);
q.push(2 * c + 1);
q.push(4 * c + 5);
}
string s;
for (int n : v) s += to_string(n);
cout << s << endl;
string r;
int t = m;
for (char c : s) {
while (!r.empty() && r.back() < c && t > 0) {
r.pop_back();
t--;
}
r.push_back(c);
}
if (t > 0) r = r.substr(0, r.size() - t);
cout << r << endl;
}
这里空空如也






有帮助,赞一个