Skip to content

Commit ea71981

Browse files
committed
[BOJ] #9996. 한국이그리울땐서버에접속하지/실버3/실패
https://www.acmicpc.net/problem/9996
1 parent 6822e4c commit ea71981

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
https://www.acmicpc.net/problem/9996
3+
"""
4+
N = int(input())
5+
# Q. a*b는 asbasd도 정답인가?
6+
# 1. 변수 입력 받기
7+
pattern = list(input().split('*'))
8+
cmstr = [[] for k in range(N)]
9+
10+
for i in range(N):
11+
# cmstr[i] = [x for x in input()]
12+
cmstr[i] = input()
13+
#2.
14+
15+
for i in range(N):
16+
# 패턴 앞, 뒤 매칭하기
17+
if cmstr[i][:len(pattern[0])] != pattern[0] or cmstr[i][-len(pattern[-1]):] != pattern[-1]:
18+
print("NE")
19+
continue
20+
# 안 맞음
21+
22+
flag = [False * len(pattern[1:-1])]
23+
point = len(pattern[0])
24+
for p in pattern[1:-1] : # 패턴 내부
25+
cnt = cmstr[i][point:].find(p)
26+
if cnt < 0 : #없으면
27+
print("NE")
28+
break
29+
# 있으면 - 그 이전에 있음
30+
point = cnt
31+
32+
print("DA")
33+
34+

0 commit comments

Comments
 (0)