250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- posix
- 엔티티 그래프
- 운영체제
- 강화학습
- 연결리스트 종류
- 최대 힙
- 백준 장학금
- 프로세스
- JPA
- 힙트리
- heapq
- 알고리즘
- 완전이진트리
- JVM
- 점근적 표기법
- python
- spring
- 백준장학금
- 이분탐색이란
- MSA
- AVL트리
- 멀티프로세서
- 스케줄링
- 연결리스트
- 자료구조
- 최소힙
- Kruskal
- SpringSecurity
- HTTP
- jpa n+1 문제
Archives
- Today
- Total
KKanging
[백준] 28432번 끝말잇기 (python) 본문
from sys import stdin
from collections import deque
input = stdin.readline
N = int(input())
str_li = []
s1 , s2 = '@','@'
for i in range(N):
temp = input()[:-1] #문자열
if temp == "?":
if str_li:
s1 = str_li[-1][-1]
else:
pass
if str_li:
if str_li[-1] == '?':
s2 = temp[0]
str_li.append(temp)
M = int(input())
for i in range(M):
temp = input()[:-1]
if (temp[0] == s1 or s1=='@') and (temp[-1] == s2 or s2=='@'):
if temp not in str_li:
print(temp)
break
'기타 > 백준' 카테고리의 다른 글
[백준]28438 행렬연산(행렬 계산하기) python (0) | 2023.08.07 |
---|