rt;
#include <bits/stdc++.h>
using namespace std;
int k,m,cnt=0;
priority_queue<int,vector<int>,greater<int> >q;
string s;
int main()
{
cin>>k>>m;
q.push(1);
for(int i=1;i<=k;i++)
{
int now=q.top();
s+=to_string(now);
q.pop();
q.push(now*2+1);
q.push(now*4+5);
}
cout<<s<<endl;
while(1)
{
for(int i=0;i<s.size()-1;i++)
{
if(s[i]<s[i+1])
{
cnt++;
s.erase(i,1);
if(cnt>=m)
{
cout<<s;
exit(0);
}
break;
}
}
}
return 0;
}
用 k = 10 , m = 15,直接tle,但是题目过了。