코딩공부/Softeer

[Softeer/C++] [21년 재직자 대회 예선] 비밀 메뉴

usingsystem 2024. 3. 11. 12:28
728x90

https://softeer.ai/practice/6269/history?questionType=ALGORITHM

 

Softeer - 현대자동차그룹 SW인재확보플랫폼

 

softeer.ai

소스코드

#include <string>
using namespace std;

int main()
{
	int m,n,k;
	cin >> m>>n>>k;

	string secrit;
	string input;
	string inputButton;
	for (int i = 0; i < m; i++)
	{
		cin >> input;
		secrit += input;
	}

	string temp;
	int idx =0 ;
	bool isSecret = false;
	for (int i = 0; i < n; i++)
	{
		cin >> input;
		inputButton += input;
	
		if (inputButton.size() >= secrit.size())
		{
			temp =	inputButton.substr(idx, secrit.size());
		
			if (temp._Equal(secrit))
			{
				isSecret = true;
				break;
			}
				idx++;
		}
	}

	if(isSecret)
				cout << "secret";
	else
	cout << "normal";
}
728x90