求助0分
查看原帖
求助0分
670481
jxzkilm楼主2022/5/21 10:24

代码如下

#include<bits/stdc++.h>
using namespace std;
int a[300001],k,m;

int main(){
	cin>>k>>m;
	int top=1,w=1;
	a[1]=1;
	for(int i=1;i<=k+5;i++){
		a[++top]=a[w]*2+1;
		a[++top]=a[w]*4+5;
		w++;
	}
	for(w;w<=k+1;w++){
		a[++top]=a[w]*2+1;
		a[++top]=a[w]*4+5;
	}
	char b[50001];
	sort(a+1,a+k+6);
	string ss;
	for(int i=1;i<=k;i++){
		cout<<a[i];
		sprintf(b,"%d",a[i]);
		ss+=b[i];
	}
	
	cout<<endl;
	for(int t=1;t<=m;t++){
		for(int i=1;i<=strlen(b);i++){
			ss.erase(i,1);
			m--;
			break;
		}
	}
	cout<<ss;
	return 0;
}
2022/5/21 10:24
加载中...