Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <map>
- #include <string.h>
- #include <math.h>
- #include <set>
- #include <stack>
- #include <queue>
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define cy cout << "YES\n"
- #define cn cout << "NO\n"
- #define nl "\n"
- #define fi first
- #define se second
- #define MOD 1000000007
- #define all(v) v.begin(), v.end()
- #define rall(v) v.end(), v.begin()
- #define sz(s) s.size()
- #define f0r(j, n) for (ll i = j; i < n; i++)
- template <typename T = int>
- istream &operator>>(istream &in, vector<T> &v)
- {
- for (auto &x : v)
- in >> x;
- return in;
- }
- template <typename T = int>
- ostream &operator<<(ostream &out, const vector<T> &v)
- {
- for (const T &x : v)
- out << x << " ";
- return out;
- }
- void sherry()
- {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- /*
- int gcd(ll a, ll b)
- {
- if (b == 0)
- return a;
- return (b, a % b);
- }
- */
- void solve()
- {
- int n, m;
- cin >> n >> m;
- string s;
- bool flag = 0;
- cin >> s;
- for (int i = 0; i < sz(s); i++)
- {
- if (s[i] - '0' < m and flag == 0)
- {
- cout << m;
- flag = 1;
- }
- cout << s[i];
- }
- if (flag == 0)
- cout << m;
- cout << nl;
- }
- int main()
- {
- sherry();
- int t = 1;
- cin >> t;
- while (t--)
- solve();
- return 0;
- }
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement