Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define pb push_back
- #define ppb pop_back
- int main()
- {
- vector<ll int> v;
- string s = "";
- function<void(char)> func = [&](char c)
- {
- s.pb(c);
- v.pb(stoll(s));
- for(char ch=c-1; ch>='0'; ch--)
- func(ch);
- s.ppb();
- };
- for(int ch='0'; ch<='9'; ch++)
- func(ch);
- sort(v.begin(), v.end());
- int k;
- cin>>k;
- cout<<v[k]<<"\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment