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 |
Tags
- 힙트리
- posix
- Kruskal
- 운영체제
- 멀티프로세서
- heapq
- HTTP
- jpa n+1 문제
- 프로세스
- 최소힙
- AVL트리
- 자료구조
- SpringSecurity
- MSA
- 최대 힙
- 이분탐색이란
- 연결리스트 종류
- 완전이진트리
- 백준 장학금
- 연결리스트
- 백준장학금
- 점근적 표기법
- 스케줄링
- spring
- JVM
- python
- 알고리즘
- JPA
- 강화학습
- 엔티티 그래프
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 |
---|