자라는 개발자/문제풀이
c++ 백준 27964 콰트로치즈피자
자란다
2023. 5. 20. 14:08
728x90
반응형
백준 27964 콰트로치즈피자
https://www.acmicpc.net/problem/27964
#include <set>
#include <string>
#include <iostream>
using namespace std;
void fast_io(void)
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main(void)
{
fast_io();
set<string> s;
int n=0;
string check = "Cheese";
cin >> n;
while(n--)
{
string str;
cin >> str;
if(str.find(check,str.size()-6)!=string::npos)
s.insert(str);
}
if(s.size() >= 4)
cout << "yummy";
else
cout << "sad";
}
첫 제출시 Cheese 문자가 끝(MozaCheese)인지 , 앞(CheeseBurger)인지 고려하지 않아서 틀렸다. find()로 인덱스 체크 후 제출했더니 통과했다
728x90
반응형