More actions
imported>Unknown No edit summary |
(Repair batch-0001 pages from live compare) |
||
| Line 14: | Line 14: | ||
void main() | void main() | ||
{ | { | ||
char buffur | char buffur[255]; | ||
cin >> buffur; | cin >> buffur; | ||
int strSize = strlen(buffur); | int strSize = strlen(buffur); | ||
| Line 22: | Line 22: | ||
{ | { | ||
//// 한글인가? | //// 한글인가? | ||
if (0 > buffur | if (0 > buffur[i]) | ||
{ | { | ||
if (buffur | if (buffur[i] != buffur[nowCheck - 1] || buffur[i + 1] != buffur[nowCheck] ) | ||
{ | { | ||
isSame = FALSE; | isSame = FALSE; | ||
| Line 34: | Line 34: | ||
else | else | ||
{ | { | ||
if (buffur | if (buffur[i] != buffur[nowCheck]) | ||
{ | { | ||
isSame = FALSE; | isSame = FALSE; | ||
| Line 49: | Line 49: | ||
---- | ---- | ||
[[Basic알고리즘]] [[Basic알고리즘/팰린드롬]] | [[Basic알고리즘]] [[Basic알고리즘/팰린드롬]] | ||
Latest revision as of 23:56, 26 March 2026
Basic알고리즘/팰린드롬/조현태
느낀점
파이썬은 좋겠다. 코드가 짧아서.ㅋ 씨는 슬퍼..T.T
=== 코드 ===
#include <iostream>
using namespace std;
#define TRUE 1
#define FALSE 0
void main()
{
char buffur[255];
cin >> buffur;
int strSize = strlen(buffur);
int nowCheck = strSize - 1;
bool isSame = TRUE;
for (register unsigned int i = 0; i < strSize / 2; ++i)
{
//// 한글인가?
if (0 > buffur[i])
{
if (buffur[i] != buffur[nowCheck - 1] || buffur[i + 1] != buffur[nowCheck] )
{
isSame = FALSE;
break;
}
++i;
nowCheck -= 2;
}
else
{
if (buffur[i] != buffur[nowCheck])
{
isSame = FALSE;
break;
}
--nowCheck;
}
}
if (isSame)
cout << "true" << endl;
else
cout << "false" << endl;
}