# 단순 구현
지문을 읽어보면 반복시키면 뭔가 반례가 나올 것 처럼 되어있지만,
결국 펠린드롬인 문장을 반복시켜야 펠린드롬이 된다.
-> 주어진 문장 펠린드롬인지 검사하면 된다.
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
char str[250005];
long long n;
bool find()
{
int len = strlen(str);
for (int i = 0; i < len/2; i++)
{
if (str[i] != str[len - i-1])
return false;
}
return true;
}
int main()
{
scanf("%s%lld", str, &n);
if (find())
printf("YES");
else
printf("NO");
return 0;
}'IT > BOJ' 카테고리의 다른 글
| 백준(BOJ) 2667 단지번호붙이기 * (0) | 2019.03.14 |
|---|---|
| 백준(BOJ) 2665 미로만들기 * (0) | 2019.03.13 |
| 백준(BOJ) 16190 Rising Sun ** (0) | 2018.10.07 |
| 백준(BOJ) 16192 Voronoi Diagram Returns * (0) | 2018.10.07 |
| 백준(BOJ) 16174 점프왕 젤리 ** (0) | 2018.10.04 |