-
백준 10988번 : 팰린드롬인지 확인하기 C언어c c++ 언어 공부 2023. 3. 6. 11:32
https://www.acmicpc.net/problem/10988 : 백준 문제 링크
Code:
123456789101112131415161718192021#include <stdio.h>#include <string.h>int main(){char arr[101] = { 0, };scanf("%s", arr);int len = strlen(arr);int a=0, b=len-1;int flag = 1;while (a<=b){if (arr[a] != arr[b]){flag = 0;}a++;b--;}printf("%d", flag);}cs 문자열을 입력 후 맨 처음과 끝부터 시작해서 안쪽으로 들어가면서 같은지 확인해준다.
'c c++ 언어 공부' 카테고리의 다른 글
백준 13241번 : 최소공배수 C언어 (0) 2023.03.06 백준 1850번 : 최대공약수 C언어 (0) 2023.03.06 백준 10798번 : 세로읽기 C언어 (0) 2023.03.05 백준 2583번 : 영역 구하기 C언어 (0) 2023.03.05 백준 9506번 : 약수들의 합 C언어 (0) 2023.03.05