fragment-header
fragment-markdown
홈
로그인
로그아웃
내 블로그
설정
로그인
백준 33779 (C++) Back and Forth
최초 업로드: 2025-04-15 10:32:51
최근 수정 시간: 2025-07-25 09:49:45
게시자: rlatjwls3333
카테고리: 백준
조회수: 8
# [Bronze III] Back and Forth [문제 링크](https://www.acmicpc.net/problem/33779) ## 문제 설명 <p>Steve has hit the jackpot at his local flea market. He bought a cheap scanner with a special ability: it detects palindrome words! Unfortunately the algorithm that checks the words is broken, thus Steve asked you to write a new algorithm to implement in the scanner and revive it's glory once more.</p> <p>Remember that a palindrome word is a word that reads the same when reversed: racecar for example is a palindrome. </p> ## 입력 <p>The input consists of a string s, having length $1 leq |s| leq 1000000$.</p> ## 출력 <p>Your program should output "beep" if the string s is a palindrome, "boop" otherwise.</p> ## 풀이 #### 간단한 팰린드롬 체크 문제입니다. ``` c++ #include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); string s; cin >> s; for(int i=0;i<s.length()/2;i++) { if(s[i]!=s[s.length()-1-i]) { cout << "boop"; return 0; } } cout << "beep"; } ```