728x90
문제

제약조건

메모리 제약

입/출력

문제 분석
1. String 사이의 공백을 제거
2. contains로 비교
3. true면 secret, 없으면 normal
풀이
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
// https://softeer.ai/practice/6269
/*
* K : 버튼의 최대 범위
* N : 갯수
* M : 버튼을 누른 횟수
*
* 하나로 합쳐서 contain으로 확인하면 될듯?
*
* 첫줄 : M, N, K
* 둘쨋줄 : 비밀메뉴
* 셋쨋줄 : 사용자 입력
*
* 있으면 secret, 없으면 normal
*
*/
String MNK = bf.readLine();
String secret = bf.readLine();
String inputs = bf.readLine();
// 문자열 합치기
secret = secret.replaceAll(" ", "");
inputs = inputs.replaceAll(" ", "");
if (inputs.contains(secret)) {
System.out.println("secret");
} else {
System.out.println("normal");
}
}
}
성공

링크
https://softeer.ai/practice/6269
Softeer - 현대자동차그룹 SW인재확보플랫폼
softeer.ai
728x90
반응형
LIST
'Etc > 알고리즘' 카테고리의 다른 글
| [softeer] 9498 (0) | 2024.07.29 |
|---|---|
| [softeer] 6266 (0) | 2024.07.25 |
| [softeer] 6282 (1) | 2024.07.24 |
| [softeer] 9657 (0) | 2024.07.22 |
| [softeer] 6283 (0) | 2024.07.19 |