Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- long int reverse(long int x){
- long int re = 0;
- while(x!=0){
- int m = x%10;
- re = re*10+m;
- x /= 10;
- }
- return re;
- }
- int main(){
- int n;
- cin >> n;
- for(int i=0;i<n;i++){
- long int t;
- cin >> t;
- long int u = t;
- while(1){
- u += 1;
- if(u == reverse(u)){
- cout << u;
- break;
- }
- }
- if(i!=n-1){
- cout << endl;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment