1259번: 팰린드롬수
입력은 여러 개의 테스트 케이스로 이루어져 있으며, 각 줄마다 1 이상 99999 이하의 정수가 주어진다. 입력의 마지막 줄에는 0이 주어지며, 이 줄은 문제에 포함되지 않는다.
www.acmicpc.net
#include <iostream>
#include <cstring>
using namespace std;
int main() {
while (1) {
string word; bool Pal = 1;
cin >> word; if (word == "0") break;
for (int i = 0; i < word.size() / 2; i++)
if (word[i] != word[word.size()-1 - i]) Pal = 0;
cout << (Pal ? "yes" : "no") << endl;
}
return 0;
}
yes를 yse로 적어놓고 제출5번함; ㅋ 엣쿵~~
'CodingTest > 백준' 카테고리의 다른 글
[c++] 백준 - 1759번: 암호 만들기 | 재귀함수 (0) | 2023.07.20 |
---|---|
[c++] 백준 - 15649번: N과 M (1) | 재귀함수, string (0) | 2023.07.18 |
[c++] 백준 - 2798번: 블랙잭 (0) | 2023.05.31 |
[c++] 백준 - 1978: 소수 찾기 (0) | 2023.05.29 |
[c++] 백준 - 10250번: ACM 호텔 (0) | 2023.05.28 |