Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- bool isPalin(int n) {
- string s = to_string(n);
- for (int i = 0; i < s.size() / 2; i++) {
- if (s[i] != s[s.size() - i - 1]) return false;
- }
- return true;
- }
- void solve() {
- int n; cin >> n;
- do {
- n++;
- } while (!isPalin(n));
- cout << n << '\n';
- }
- signed main() {
- cin.tie(0)->sync_with_stdio(0);
- freopen("in" , "r", stdin );
- freopen("out", "w", stdout);
- int T; cin >> T;
- while (T--) solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement