删数后为最小数
#include <bits/stdc++.h>
using namespace std;
int n , k , pos=0;
int a[90005] , b[90005];
priority_queue <int , vector <int> , greater <int> > q;
int main () {
cin>>n>>k;
q.push(1);
int sum = 0;
int cnt = 0;
while(1){
int x = q.top() , d = 0;
q.pop();
q.push(2 * x + 1);
q.push(4 * x + 5);
a[++cnt] = x;
while(x != 0){
d = d * 10 + x % 10;
x /= 10;
}
while(d != 0){
b[++ sum] = d % 10;
d /= 10;
}
if(cnt >= n)
break;
}
for(int i = 1;i <= cnt;i ++){
cout << a[i];
}
cout << endl;
for(int i = 1;i <= k;i ++){
for(int j = 0;j < sum;j ++){
if(b[j] > b[j + 1]){
for(int l = j;l < sum;l ++){
b[l] = b[l + 1];
}
sum --;
break;
}
}
}
int r = 0;
while(b[r] == 0 && r < sum - 1){
r ++;
pos ++;
}
for(int i = pos;i < sum;i ++){
cout << b[i];
}
return 0;
}