We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 214ab95 commit 2372c94Copy full SHA for 2372c94
1 file changed
live10/test105/문제2/박희경.py
@@ -0,0 +1,40 @@
1
+import sys
2
+
3
+input = sys.stdin.readline
4
5
+alpha = [chr(i) for i in range(ord('a'),ord('z')+1)]
6
+arr = [[0] * 26 for _ in range(26)]
7
8
9
+n = int(input())
10
+for _ in range(n):
11
+ i, _, j = map(str, input().split())
12
+ arr[alpha.index(i)][alpha.index(j)] = 1
13
14
+for k in range(26):
15
+ for i in range(26):
16
+ for j in range(26):
17
+ if i == j: continue
18
+ if arr[i][k] == 1 and arr[k][j] == 1:
19
+ arr[i][j] = 1
20
21
22
+m = int(input())
23
+for _ in range(m):
24
25
+ if arr[alpha.index(i)][alpha.index(j)] == 1:
26
+ print('T')
27
+ else:
28
+ print('F')
29
30
31
+"""
32
+3
33
+a is b
34
+b is c
35
+c is d
36
37
+a is d
38
+a is c
39
+d is a
40
0 commit comments