Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- bool pal(char s[])
- {
- for(int i=0;i<=3;++i)
- if(s[i]!=s[8-i-1])
- return false;
- return true;
- }
- int main()
- {
- int n;
- ifstream f("datapal.in");
- f>>n;
- char s[9];
- int F[100]={0},N=0;
- while(n--)
- {
- f>>s;
- if(pal(s))
- ++N,F[(s[4]-'0')*10+(s[5]-'0'+1)]=1;
- }
- f.close();
- ofstream g("datapal.out");
- g<<N<<'\n';
- if(N==0)
- g<<"NU EXISTA DATE PALINDROM";
- else
- {
- for(int i=0;i<100;++i)
- if(F[i])
- g<<i<<' ';
- }
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement