Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int o, c, nrc, x;
- for(unsigned long long p=121; p<=999999999999; p++)
- {
- x=p;
- o=0;
- nrc=0;
- while(x!=0)
- {
- c=x%10;
- nrc++;
- o=o*10+c;
- x/=10;
- }
- if(p==o && nrc%2==1)
- {
- //cout<<o<<" ";
- c=o%10;
- o/=10;
- bool ok=true;
- for(int i=2; i<=nrc/2+1 && ok; i++)
- {
- if(c>=o%10)
- ok=false;
- c=o%10;
- o/=10;
- }
- if(ok==true)
- cout<<p<<" ";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment