@[kongbaijun](/user/232205)
应该是删数的时候出现了问题
输入:9 12
你的输出:
13791517193133
95
实际输出应该是99吧。不一定比后一位大,就是当前最大的
by 编码落寞 @ 2022-03-09 14:35:25
@[编码落寞](/user/557751)
感谢 题解中找到一份类似我这种思想的做法
此作法会被9 12的输入hack掉(TLE)
[题解链接](https://zhaowangji.blog.luogu.org/solution-p1323)
但提交依然可以AC
```cpp
#include<bits/stdc++.h>
using namespace std;
int k,m;
priority_queue<int,vector<int>,greater<int> > cre;
string s;
int main(){
cin>>k>>m;
cre.push(1);
for(int i=1;i<=k;++i){
int x=cre.top();
s+=to_string(x);
cre.pop();
cre.push(2*x+1);
cre.push(4*x+5);
}
cout<<s<<endl;
int cnt=0;
for(;;){
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<<endl;exit(0);}
break;
}
}
}
return 0;
}
```
by little_kongbai @ 2022-03-10 16:09:01
~~试了一下题解?!~~
by JimmyQ @ 2024-01-09 21:47:12