본문 바로가기
프로그래밍/문제풀이

[ect] 백준 15904 UCPC는 무엇의 약자일까?

by 하용권 2018. 12. 22.

https://www.acmicpc.net/problem/15904



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <iostream>
using namespace std;
 
int main(){
    string s;
    bool chk[4= {0};
    getline(cin,s);
    
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'U'){
            chk[0= true;
        }
        if(s[i] == 'C'){
            if(chk[0]) chk[1= true;
            if(chk[2]) {chk[3= truebreak;}
        }
        if(s[i] == 'P'){
            if(chk[1]) chk[2= true;
        }
 
    }
    if(chk[3]) cout << "I love UCPC";
    else        cout << "I hate UCPC";
}
cs


반응형

'프로그래밍 > 문제풀이' 카테고리의 다른 글

[bfs] 백준 15900 나무 탈출  (2) 2018.12.24
[etc] 백준 15903 카드 합체 놀이  (0) 2018.12.22
[etc] 백준 15954 인형들  (0) 2018.12.18
[dp] 백준 9461 파도반 수열  (0) 2018.12.11
[etc] 백준 2164 카드2  (0) 2018.12.11