정수를 문자열로 바꾸어 펠린드롬인지 확인하는 간단한 문제다.
결국 1753번 문제를 못 풀었다.
#include <iostream>
#include <string>
using namespace std;
void find_answer(int temp)
{
string str = to_string(temp);
int len = str.length();
int i;
for (i = 0; i < len / 2; i++)
{
if (str[i] == str[len - 1 - i])
{
;
}
else
{
cout << "no\n";
return;
}
}
cout << "yes\n";
return;
}
int main(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int temp;
while (1)
{
cin >> temp;
if (temp == 0)
{
break;
}
find_answer(temp);
}
return 0;
}