游客 Signup | Login
中文 | En

1723 - 中级第五课——找回文数1

找出10000以内的回文数。
 从左向右读与从右向左读是同一个数的数为回文数,如19391是回文数。

<br />

Input


Output

输出所有符合条件的回文数,

Examples

Input


                

Output


                

Solution C++

#include <cmath>          
#include <iostream>  
using namespace std;  
int main()  
{  
    int a,b,c,d;      
    for(a=2;a<10000;a++){  
        b=a;  
        d=0;  
        while(b>0){  
            c=b%10;  
            d=d*10+c;  
            b=b/10;  
        }  
        if(a==d){  
            cout<<a<<' ';  
        }  
        }  
    cout<<endl;  
    return 0;  
}  
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题