Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- ifstream in("palindrom2.in");
- ofstream out("palindrom2.out");
- int main()
- {
- int x, n, p, v[10], z, k ,l, i,j,f;
- bool ok=true;
- in>>p>>n;
- for(f=1; f<=n; f++)
- {
- in>>x;
- ok=true;
- z=0; l=0; i=1;
- while(x)
- {
- v[i]=x%10;
- x=x/10;
- i++;
- }
- j=i;
- for(k=1; k<=j/2; k++)
- {
- if(v[k]==v[j-k+1]) ok=true;
- else ok=false;
- }
- if(ok==true) z++;
- else if(ok==false) l++;
- }
- if(p==1) out<<z;
- else out<<l;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement