백준 c++ 15904 UCPC는 무엇의 약자일까?

jaranda·2022년 3월 9일
0

15904 UCPC는 무엇의 약자일까?


문제풀이

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
void fast_io(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}
int main(void)
{
    fast_io();
    string str, res = "UCPC";
    int cnt = 0;
    getline(cin, str);
    for (int i = 0; i < str.length(); i++)
    {
        if (str[i]==res[cnt])
            cnt++;
    }
    if (cnt<4)
        cout << "I hate UCPC";
    else
        cout << "I love UCPC";
}

어찌됐든 순서대로 UCPC 가 들어있으면 된다.

profile
자라는 개발자

0개의 댓글

관련 채용 정보