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
반응형
'자라는 개발자 > 문제풀이' 카테고리의 다른 글
c++ 2021 카카오 채용연계형 인턴십 - 숫자 문자열과 영단어 (0) | 2023.08.15 |
---|---|
leetcode 169. Majority ElementEasy (0) | 2023.01.15 |
leetcode 383. Ransom Note (0) | 2022.11.13 |
leetcode 387. First Unique Character in a String (0) | 2022.11.13 |
leetcode 350. Intersection of Two Arrays II (0) | 2022.11.13 |