Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool palindrom(int n)
- {
- int cn=n,ogl=0;
- while(n) ///construirea oglinditului
- ogl=ogl*10+n%10,n=n/10;
- if(cn==ogl)
- return true;
- return false;
- }
- bool nrparasociat(int n,int &na)
- {
- int p=1,ncp=0;
- na=0;
- if(n==0)
- return true;
- while(n)
- {
- if(n%10%2==0)
- ++ncp,na+=p*(n%10),p*=10;
- n/=10;
- }
- if(ncp)
- return true;
- return false;
- }
- int main()
- {
- int n;
- cin>>n;
- int x,xa=0;
- int c=0;
- for(int i=1;i<=n;++i)
- {
- cin>>x;
- if(nrparasociat(x,xa))
- if(palindrom(xa))
- ++c;
- }
- cout<<c;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement