模拟。
#include<bits/stdc++.h>
#define int long long
#define double long double
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef long long ll;
typedef pair<int,int> PII;
const int N=3e5+10;
const int M=1e3+10;
int mod=1e9+7;
int a[N];
void solve(){
int k;cin>>k;
int cnt=0;
for(int i=99999;i>=1;i--){
set<int>st;
string s=to_string(i);
while(s.size()<5) s='0'+s;
if(s.size()<5) st.insert(0);
for(auto it:s) st.insert(it-'0');
if(st.size()==5) cnt++;
if(cnt==k){
cout<<s<<endl;
return;
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int _;
_=1;
//cin>>_;
while(_--){
solve();
}
}

京公网安备 11010502036488号