Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void solve(ll pos, ll n)
- {
- if (pos == n)
- {
- ll num = 0;
- for (auto xl : aux)
- {
- num = num * 10 + z1.at(xl);
- }
- if (num > x && (sol == 0 || num < sol))
- {
- sol = num;
- }
- }
- for (int i = 0; i < n; i++)
- {
- if (find(aux.begin(), aux.end(), i) == aux.end())
- {
- aux.push_back(i);
- solve(pos + 1, n);
- aux.pop_back();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment