create dev channel
This commit is contained in:
9
zeta/py/11025.py
Normal file
9
zeta/py/11025.py
Normal file
@@ -0,0 +1,9 @@
|
||||
def solve(N, K):
|
||||
ret = 1
|
||||
for i in range(2, N + 1):
|
||||
ret = (ret + K - 1) % i + 1
|
||||
return ret
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solve(*map(int, input().split())))
|
||||
26
zeta/py/1111.py
Normal file
26
zeta/py/1111.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
1111: IQ Test
|
||||
문제:
|
||||
IQ Test의 문제 중에는 공통된 패턴을 찾는 문제가 있다. 수열이 주어졌을 때, 다음 수를 찾는 문제이다.
|
||||
예를 들어, 1, 2, 3, 4, 5가 주어졌다. 다음 수는 무엇인가? 당연히 답은 6이다.
|
||||
약간 더 어려운 문제를 보면, 3, 6, 12, 24, 48이 주어졌을 때, 다음 수는 무엇인가? 역시 답은 96이다.
|
||||
|
||||
이제 제일 어려운 문제를 보자.
|
||||
1, 4, 13, 40이 주어졌을 때, 다음 수는 무엇일까? 답은 121이다.
|
||||
그 이유는 항상 다음 수는 앞 수*3+1이기 때문이다.
|
||||
은진이는 위의 3문제를 모두 풀지 못했으므로, 자동으로 풀어주는 프로그램을 작성하기로 했다.
|
||||
항상 모든 답은 구하는 규칙은 앞 수*a + b이다. 그리고, a와 b는 정수이다.
|
||||
수 N개가 주어졌을 때, 규칙에 맞는 다음 수를 구하는 프로그램을 작성하시오.
|
||||
입력:
|
||||
첫째 줄에 N이 주어진다. N은 50보다 작거나 같은 자연수이다. 둘째 줄에는 N개의 수가 주어진다. 이 수는 모두 절댓값이 100보다 작거나 같은 정수이다.
|
||||
출력:
|
||||
다음 수를 출력한다. 만약 다음 수가 여러 개일 경우에는 A를 출력하고, 다음 수를 구할 수 없는 경우에는 B를 출력한다.
|
||||
"""
|
||||
"""
|
||||
TC1:
|
||||
Input:
|
||||
4
|
||||
1 4 13 40
|
||||
Output:
|
||||
121
|
||||
"""
|
||||
23
zeta/py/1158.py
Normal file
23
zeta/py/1158.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from collections import deque
|
||||
|
||||
|
||||
def solve(N, K):
|
||||
q = deque(range(1, N + 1))
|
||||
tq = deque()
|
||||
cnt = 0
|
||||
ret = []
|
||||
while q:
|
||||
while q:
|
||||
cnt += 1
|
||||
cnt %= K
|
||||
if cnt % K == 0:
|
||||
ret.append(q.popleft())
|
||||
else:
|
||||
tq.append(q.popleft())
|
||||
q = tq
|
||||
tq = deque()
|
||||
return "<" + ", ".join(map(str, ret)) + ">"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solve(*map(int, input().split())))
|
||||
0
zeta/py/11726.py
Normal file
0
zeta/py/11726.py
Normal file
23
zeta/py/11866.py
Normal file
23
zeta/py/11866.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from collections import deque
|
||||
|
||||
|
||||
def solve(N, K):
|
||||
q = deque(range(1, N + 1))
|
||||
tq = deque()
|
||||
cnt = 0
|
||||
ret = []
|
||||
while q:
|
||||
while q:
|
||||
cnt += 1
|
||||
cnt %= K
|
||||
if cnt % K == 0:
|
||||
ret.append(q.popleft())
|
||||
else:
|
||||
tq.append(q.popleft())
|
||||
q = tq
|
||||
tq = deque()
|
||||
return "<" + ", ".join(map(str, ret)) + ">"
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
print(solve(*map(int, input().split())))
|
||||
15
zeta/py/12100.py
Normal file
15
zeta/py/12100.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
class Pane2048:
|
||||
def __init__(self, N: int, pane: list[list[int]]):
|
||||
self.N = N
|
||||
self.pane = pane
|
||||
|
||||
@staticmethod
|
||||
def move(direction: int, N: int, pane: list[list[int]]):
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
pass
|
||||
13
zeta/py/12101.py
Normal file
13
zeta/py/12101.py
Normal file
@@ -0,0 +1,13 @@
|
||||
n, k = map(int, input().split())
|
||||
t = []
|
||||
|
||||
|
||||
# TODO:
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
24
zeta/py/1214.py
Normal file
24
zeta/py/1214.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# Px+Qy >= D
|
||||
def solve(D, P, Q):
|
||||
if D % P == 0 or D % Q == 0:
|
||||
return D
|
||||
Q, P = sorted((P, Q))
|
||||
p_bound = (D // P) + 1
|
||||
|
||||
min_S = 10 ** 13
|
||||
for x in range(0, p_bound + 1):
|
||||
|
||||
d, m = divmod(D - P * x, Q)
|
||||
if m == 0:
|
||||
return D
|
||||
new_S = (d + 1) * Q + P * x
|
||||
if new_S < min_S:
|
||||
min_S = new_S
|
||||
if min_S == D:
|
||||
return min_S
|
||||
return min_S
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
D, P, Q = map(int, input().split())
|
||||
print(solve(D, P, Q))
|
||||
33
zeta/py/1485.py
Normal file
33
zeta/py/1485.py
Normal file
@@ -0,0 +1,33 @@
|
||||
N = int(input())
|
||||
|
||||
|
||||
def check90(p1, p2, p3):
|
||||
if p2[0] - p1[0] == 0:
|
||||
if p3[1] - p1[1] == 0:
|
||||
return True
|
||||
elif p3[0] - p1[0] == 0:
|
||||
if p2[1] - p1[1] == 0:
|
||||
return True
|
||||
|
||||
return - (p3[0] - p1[0]) * (p2[1] - p1[1]) == (p3[1] - p1[1]) * (p2[0] - p1[0])
|
||||
|
||||
|
||||
for _ in range(N):
|
||||
P = [(p1x, p1y), (p2x, p2y), (p3x, p3y), (p4x, p4y)] = \
|
||||
map(int, input().split()), map(int, input().split()), map(int, input().split()), map(int, input().split())
|
||||
if check90((p1x, p1y), (p2x, p2y), (p3x, p3y)):
|
||||
(opox, opoy) = p4x, p4y
|
||||
(remx, remy) = p3x, p3y
|
||||
elif check90((p1x, p1y), (p2x, p2y), (p4x, p4y)):
|
||||
(opox, opoy) = p3x, p3y
|
||||
(remx, remy) = p2x, p2y
|
||||
elif check90((p1x, p1y), (p3x, p3y), (p4x, p4y)):
|
||||
(opox, opoy) = p2x, p2y
|
||||
(remx, remy) = p4x, p4y
|
||||
else:
|
||||
print(0)
|
||||
continue
|
||||
if (opox - p1x) ** 2 + (opoy - p1y) ** 2 == 2 * (remx - p1x) ** 2 + 2 * (remy - p1y) ** 2:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
12
zeta/py/1509.py
Normal file
12
zeta/py/1509.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
class PalindromePartition:
|
||||
def __init__(self, s: str):
|
||||
self.s = s
|
||||
self.N = len(s)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
s = input().rstrip()
|
||||
4
zeta/py/15965_sieve.py
Normal file
4
zeta/py/15965_sieve.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# 먼저 최대 개수까지 빈 리스트 만듬;
|
||||
# 그 다음 반복문 돔
|
||||
# 그리고 배수만큼을 없앰
|
||||
# 그리고 반복
|
||||
35
zeta/py/17386.py
Normal file
35
zeta/py/17386.py
Normal file
@@ -0,0 +1,35 @@
|
||||
x1, y1, x2, y2 = map(int, input().split())
|
||||
x3, y3, x4, y4 = map(int, input().split())
|
||||
|
||||
vx1, vy1 = x2 - x1, y2 - y1
|
||||
vx2, vy2 = x4 - x3, y4 - y3
|
||||
if vx1 == 0 and vy1 == 0:
|
||||
print(0)
|
||||
elif vx1 == 0 or vy1 == 0:
|
||||
if vx1 == 0:
|
||||
rx = x1
|
||||
ry = (vy2/vx2) * (rx - x3) + y3
|
||||
|
||||
t0 = (ry - y1) / vy1
|
||||
t1 = (rx - x3) / vy2
|
||||
else:
|
||||
rx = x3
|
||||
ry = (vy1 / vx1) * (rx-x1) + y1
|
||||
|
||||
t0 = (rx - x1) / vx1
|
||||
t1 = (ry - y3) / vy2
|
||||
if t0 < 0 or t0 > 1 or t1 < 0 or t1 > 1: print(0)
|
||||
else: print(1)
|
||||
else:
|
||||
a0 = vy1 / vx1
|
||||
a1 = vy2 / vx2
|
||||
|
||||
rx = (a0 * x1 - a1 * x3 + y3 - y1 )/ (a0 - a1)
|
||||
ry = a0 * (rx - x1) + y1
|
||||
|
||||
t0 = (rx - x1) / vx1
|
||||
t1 = (rx - x3) / vx2
|
||||
if a0 == a1: print(0)
|
||||
elif t0 < 0 or t0 > 1 or t1 < 0 or t1 > 1: print(0)
|
||||
else:
|
||||
print(1)
|
||||
2
zeta/py/18870.py
Normal file
2
zeta/py/18870.py
Normal file
@@ -0,0 +1,2 @@
|
||||
def solve(N, X):
|
||||
|
||||
10
zeta/py/1920.py
Normal file
10
zeta/py/1920.py
Normal file
@@ -0,0 +1,10 @@
|
||||
N = int(input())
|
||||
A = list(map(int, input().split()))
|
||||
M = int(input())
|
||||
K = list(map(int, input().split()))
|
||||
|
||||
for k in K:
|
||||
if k in A:
|
||||
print(1)
|
||||
else:
|
||||
print(0)
|
||||
0
zeta/py/19940.py
Normal file
0
zeta/py/19940.py
Normal file
52
zeta/py/2085.py
Normal file
52
zeta/py/2085.py
Normal file
@@ -0,0 +1,52 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
def count_nums(post: list[str], base: int):
|
||||
n = len(post)
|
||||
subpost = [[0 for _ in range(n)] for _ in range(n)]
|
||||
cnts = [[0 for _ in range(n)] for _ in range(n)]
|
||||
P = [0] * n
|
||||
for i in range(n):
|
||||
cnt = 0
|
||||
for j in range(i, n):
|
||||
subpost[i][j] = int("".join(post[i:j + 1]))
|
||||
for i in range(n):
|
||||
cnt = 0
|
||||
for j in range(i+1):
|
||||
if subpost[j][i] < base:
|
||||
pass
|
||||
|
||||
class BaseSpliter:
|
||||
def __init__(self, s: str):
|
||||
self.s: str = s
|
||||
self.post = []
|
||||
if len(self.s) <= 1:
|
||||
return
|
||||
self.flag = False
|
||||
if self.s[0] == "0":
|
||||
if len(self.s) > 1 and self.s[1] == 0:
|
||||
pass
|
||||
else:
|
||||
self.flag = True
|
||||
return
|
||||
for c in self.s:
|
||||
if c == "0":
|
||||
self.post[-1] += c
|
||||
else:
|
||||
self.post.append(c)
|
||||
print(self.post)
|
||||
|
||||
def solve(self) -> int:
|
||||
if not self.post:
|
||||
return 0
|
||||
elif self.flag:
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
S = input().rstrip()
|
||||
solver = BaseSpliter(S)
|
||||
# print(solver.solve())
|
||||
count_nums(["1", "2", "3"], 4)
|
||||
0
zeta/py/2447_loop.py
Normal file
0
zeta/py/2447_loop.py
Normal file
64
zeta/py/2448.py
Normal file
64
zeta/py/2448.py
Normal file
@@ -0,0 +1,64 @@
|
||||
"""
|
||||
2448: 별 찍기 - 11
|
||||
문제:
|
||||
예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.
|
||||
입력:
|
||||
첫째 줄에 N이 주어진다. N은 항상 3×2^k 수이다. (3, 6, 12, 24, 48, ...) (k ≤ 10)
|
||||
출력:
|
||||
첫째 줄부터 N번째 줄까지 별을 출력한다.
|
||||
"""
|
||||
"""
|
||||
TC1:
|
||||
Input:
|
||||
24
|
||||
Output:
|
||||
*
|
||||
* *
|
||||
*****
|
||||
* *
|
||||
* * * *
|
||||
***** *****
|
||||
* *
|
||||
* * * *
|
||||
***** *****
|
||||
* * * *
|
||||
* * * * * * * *
|
||||
***** ***** ***** *****
|
||||
* *
|
||||
* * * *
|
||||
***** *****
|
||||
* * * *
|
||||
* * * * * * * *
|
||||
***** ***** ***** *****
|
||||
* * * *
|
||||
* * * * * * * *
|
||||
***** ***** ***** *****
|
||||
* * * * * * * *
|
||||
* * * * * * * * * * * * * * * *
|
||||
***** ***** ***** ***** ***** ***** ***** *****
|
||||
"""
|
||||
|
||||
|
||||
s = [" * ", " * * ", "***** "]
|
||||
|
||||
|
||||
def makestar(shift):
|
||||
global s
|
||||
c = len(s)
|
||||
for i in range(c):
|
||||
s.append(s[i] + s[i]) # 현 단계 삼각형을 뒤에 붙이고
|
||||
print(s)
|
||||
s[i] = (" " * shift + s[i] + " " * shift) # 현 단계 삼각형을 오른쪽으로 민다
|
||||
print(s)
|
||||
|
||||
|
||||
n = int(input())
|
||||
k= n//6
|
||||
for i in range(k):
|
||||
print(int(pow(2,i)))
|
||||
makestar(int(pow(2, i)))
|
||||
|
||||
for i in range(n):
|
||||
print(s[i])
|
||||
print(s)
|
||||
print(k)
|
||||
40
zeta/py/2504.py
Normal file
40
zeta/py/2504.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
2504: 괄호의 값
|
||||
문제:
|
||||
4개의 기호 ‘(’, ‘)’, ‘[’, ‘]’를 이용해서 만들어지는 괄호열 중에서 올바른 괄호열이란 다음과 같이 정의된다.
|
||||
|
||||
1. 한 쌍의 괄호로만 이루어진 ‘()’와 ‘[]’는 올바른 괄호열이다.
|
||||
2. 만일 X가 올바른 괄호열이면 ‘(X)’이나 ‘[X]’도 모두 올바른 괄호열이 된다.
|
||||
3. X와 Y 모두 올바른 괄호열이라면 이들을 결합한 XY도 올바른 괄호열이 된다.
|
||||
|
||||
예를 들어 ‘(()[[]])’나 ‘(())[][]’ 는 올바른 괄호열이지만 ‘([)]’ 나 ‘(()()[]’ 은 모두 올바른 괄호열이 아니다.
|
||||
우리는 어떤 올바른 괄호열 X에 대하여 그 괄호열의 값(괄호값)을 아래와 같이 정의하고 값(X)로 표시한다.
|
||||
|
||||
1. ‘()’ 인 괄호열의 값은 2이다.
|
||||
2. ‘[]’ 인 괄호열의 값은 3이다.
|
||||
3. ‘(X)’ 의 괄호값은 2×값(X) 으로 계산된다.
|
||||
4. ‘[X]’ 의 괄호값은 3×값(X) 으로 계산된다.
|
||||
5. 올바른 괄호열 X와 Y가 결합된 XY의 괄호값은 값(XY)= 값(X)+값(Y) 로 계산된다.
|
||||
|
||||
예를 들어 ‘(()[[]])([])’ 의 괄호값을 구해보자. ‘()[[]]’ 의 괄호값이 2 + 3×3=11 이므로 ‘(()[[ ]])’의 괄호값은 2×11=22 이다.
|
||||
그리고 ‘([])’의 값은 2×3=6 이므로 전체 괄호열의 값은 22 + 6 = 28 이다.
|
||||
|
||||
여러분이 풀어야 할 문제는 주어진 괄호열을 읽고 그 괄호값을 앞에서 정의한대로 계산하여 출력하는 것이다.
|
||||
입력:
|
||||
첫째 줄에 괄호열을 나타내는 문자열(스트링)이 주어진다. 단 그 길이는 1 이상, 30 이하이다.
|
||||
|
||||
출력:
|
||||
첫째 줄에 그 괄호열의 값을 나타내는 정수를 출력한다. 만일 입력이 올바르지 못한 괄호열이면 반드시 0을 출력해야 한다.
|
||||
"""
|
||||
"""
|
||||
TC1:
|
||||
Input:
|
||||
(()[[]])([])
|
||||
Output:
|
||||
28
|
||||
"""
|
||||
import re
|
||||
Input = input()
|
||||
par_regex = re.compile(r'\((.*?)\)')
|
||||
t = par_regex.search(Input)
|
||||
print(t.groups())
|
||||
0
zeta/py/2687.py
Normal file
0
zeta/py/2687.py
Normal file
40
zeta/py/30869.py
Normal file
40
zeta/py/30869.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import sys
|
||||
import heapq
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
if __name__ == "__main__":
|
||||
N, M, K = map(int, input().split())
|
||||
L = [[] for _ in range(M + 1)]
|
||||
for _ in range(M):
|
||||
s, e, t, g = map(int, input().split())
|
||||
L[s].append((e, t, g))
|
||||
res = 100000000000
|
||||
|
||||
D = []
|
||||
vis_tmp = [0] * (N + 1)
|
||||
vis_tmp[1] = 1
|
||||
heapq.heappush(
|
||||
D,
|
||||
(0, 1, K, vis_tmp),
|
||||
)
|
||||
while D:
|
||||
now_t, now_stop, now_k, vis = heapq.heappop(D)
|
||||
vis[now_stop] = 1
|
||||
if now_stop == N:
|
||||
res = min(res, now_t)
|
||||
break
|
||||
|
||||
for e, t, g in L[now_stop]:
|
||||
if vis_tmp[e]:
|
||||
continue
|
||||
if now_t % g == 0:
|
||||
heapq.heappush(D, (now_t + t, e, now_k, vis.copy()))
|
||||
else:
|
||||
heapq.heappush(D, (now_t + -now_t % g + g + t, e, now_k, vis.copy()))
|
||||
# 버스 소환술 사용
|
||||
if now_k >= 1:
|
||||
heapq.heappush(D, (now_t + t, e, now_k - 1, vis.copy()))
|
||||
else:
|
||||
res = -1
|
||||
print(res)
|
||||
31
zeta/py/32526.py
Normal file
31
zeta/py/32526.py
Normal file
@@ -0,0 +1,31 @@
|
||||
class ConstructString:
|
||||
def __init__(self, n, k):
|
||||
self.n = n
|
||||
self.k = k
|
||||
|
||||
def solve(self) -> tuple[str]:
|
||||
if self.k == 0:
|
||||
if self.n <= 2:
|
||||
return ("No",)
|
||||
else:
|
||||
return "Yes", "abc" * self.n // 3 + "abc"[: self.n % 3]
|
||||
elif self.k == self.n - 1:
|
||||
return "Yes", "a" * self.n
|
||||
|
||||
s = [-1] * self.n
|
||||
for i in range(self.k):
|
||||
s[i] = 0
|
||||
s[self.n - i - 1] = 0
|
||||
|
||||
if self.n - self.k - 1 >= self.k and s[self.n - self.k - 1] == -1:
|
||||
s[self.n - self.k - 1] = 1
|
||||
|
||||
for i in range(self.n):
|
||||
if s[i] == -1:
|
||||
s[i] = 2
|
||||
|
||||
return "Yes", s
|
||||
if __name__ == "__main__":
|
||||
n, k = map(int, input().split())
|
||||
solver = ConstructString(n, k)
|
||||
print(*solver.solve(), sep="\n")
|
||||
33
zeta/py/3645.py
Normal file
33
zeta/py/3645.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# 선영이가 이길 수 있는 솔루션은 하나 이상 Because 선영이가 지는 팀을 이길 수 있는 팀이 하나 이상 주어짐
|
||||
# 아마도 'Top-Down' 으로 구현하는게 좋을듯 어짜피 마지막에선 선형이가 이길 수 있는 대상이 나와야 하니까
|
||||
|
||||
while True:
|
||||
T = []
|
||||
try:
|
||||
N = int(input())
|
||||
Seed = [list(map(int, input())) for _ in range(N)]
|
||||
except EOFError:
|
||||
break
|
||||
for i in range(N):
|
||||
if Seed[0][i]:
|
||||
T.append([[(0, i)], [0, i], [0, i]]) # share-plate, check-plate, used-plate
|
||||
while T:
|
||||
share, check, used = T.pop()
|
||||
if len(share) == N-1:
|
||||
print(share)
|
||||
break
|
||||
Temp = [[0]*N for _ in range(len(check))]
|
||||
for idx, chck in enumerate(check):
|
||||
for i in range(N):
|
||||
if chck == i:
|
||||
continue
|
||||
if not Seed[chck][i] and i not in used:
|
||||
Temp[idx][i] = 1
|
||||
# 난 못하겠소 다시는 못하겠소
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print(T)
|
||||
print('g')
|
||||
21
zeta/py/7579.py
Normal file
21
zeta/py/7579.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
class ApplicationMemorySwap:
|
||||
def __init__(self, n: int, m: int, mem: list[int], cost: list[int]):
|
||||
self.n: int = n
|
||||
self.m: int = m
|
||||
self.mem: list[int] = mem
|
||||
self.cost: list[int] = cost
|
||||
|
||||
def solve(self) -> int:
|
||||
knapsack = [0] * (self.m + 1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
n , m = map(int, input().split())
|
||||
mem = list(map(int, input().split()))
|
||||
cost = list(map(int, input().split()))
|
||||
solver = ApplicationMemorySwap(n, m, mem, cost)
|
||||
print(solver.solve())
|
||||
13
zeta/py/9375.py
Normal file
13
zeta/py/9375.py
Normal file
@@ -0,0 +1,13 @@
|
||||
TC = int(input())
|
||||
|
||||
for _ in range(TC):
|
||||
S = 0
|
||||
T = {}
|
||||
N = int(input())
|
||||
for _ in range(N):
|
||||
p, q = input().split()
|
||||
if q in T:
|
||||
T[q] += 1
|
||||
else:
|
||||
T[q] = 1
|
||||
for i in range()
|
||||
0
zeta/py/9663_python_optimized.py
Normal file
0
zeta/py/9663_python_optimized.py
Normal file
17
zeta/py/completed/1002.py
Normal file
17
zeta/py/completed/1002.py
Normal file
@@ -0,0 +1,17 @@
|
||||
T = int(input())
|
||||
for i in range(T):
|
||||
x1, y1, r1, x2, y2, r2 = map(int, input().split())
|
||||
dist:int = (x1-x2)**2 + (y1- y2)**2
|
||||
distR:int = (r1+r2)**2
|
||||
if dist == 0 and r1 == r2:
|
||||
print(-1)
|
||||
elif dist < (r1-r2)**2:
|
||||
print(0)
|
||||
elif dist == (r1-r2)**2:
|
||||
print(1)
|
||||
elif dist > distR:
|
||||
print(0)
|
||||
elif dist < distR:
|
||||
print(2)
|
||||
elif dist == distR:
|
||||
print(1)
|
||||
37
zeta/py/completed/1005.py
Normal file
37
zeta/py/completed/1005.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
import os
|
||||
import io
|
||||
|
||||
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
|
||||
|
||||
sys.setrecursionlimit(1000000)
|
||||
|
||||
Mem: list
|
||||
D: list
|
||||
E: list
|
||||
|
||||
|
||||
def get_time(now):
|
||||
if Mem[now] != -1:
|
||||
return Mem[now]
|
||||
elif not E[now]:
|
||||
Mem[now] = D[now]
|
||||
return D[now]
|
||||
else:
|
||||
s = max([get_time(target) for target in E[now]]) + D[now]
|
||||
Mem[now] = s
|
||||
return s
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
T = int(input())
|
||||
for _ in range(T):
|
||||
N, K = map(int, input().split())
|
||||
D = [0] + list(map(int, input().split()))
|
||||
E = [[] for _ in range(N + 1)]
|
||||
for _ in range(K):
|
||||
u, v = map(int, input().split())
|
||||
E[v].append(u)
|
||||
W = int(input())
|
||||
Mem = [-1] * (N + 1)
|
||||
print(get_time(W))
|
||||
20
zeta/py/completed/1010.py
Normal file
20
zeta/py/completed/1010.py
Normal file
@@ -0,0 +1,20 @@
|
||||
def case(N, M):
|
||||
"""
|
||||
정의역의 원소가 N개이고 치역의 공역의 원소가 M개인 일대일 '증가' 함수의 경우의 수
|
||||
(M)C(N)
|
||||
"""
|
||||
ans = 1
|
||||
for i in range(M - N + 1, M + 1):
|
||||
ans *= i
|
||||
for i in range(1, N + 1):
|
||||
ans //= i
|
||||
return ans
|
||||
|
||||
|
||||
def solve(T, I):
|
||||
return "\n".join([str(case(*I[i])) for i in range(T)])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
T = int(input())
|
||||
print(solve(T, [list(map(int, input().split())) for _ in range(T)]))
|
||||
16
zeta/py/completed/1011.py
Normal file
16
zeta/py/completed/1011.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import math
|
||||
T = int(input())
|
||||
|
||||
for i in range(T):
|
||||
x, y = map(int, input().split())
|
||||
distance = y - x
|
||||
disted = distance ** (1 / 2)
|
||||
upper = math.ceil(disted)
|
||||
|
||||
lowersq = (upper - 1)**2
|
||||
uppersq = upper**2
|
||||
|
||||
if (lowersq + uppersq)/2 <= distance:
|
||||
print(upper * 2 -1)
|
||||
else:
|
||||
print(upper * 2 - 2)
|
||||
50
zeta/py/completed/1012.py
Normal file
50
zeta/py/completed/1012.py
Normal file
@@ -0,0 +1,50 @@
|
||||
def find_group(Map, M, N, i, j):
|
||||
ret = []
|
||||
temp = []
|
||||
temp.append((i, j))
|
||||
while temp:
|
||||
t = temp.pop()
|
||||
if t in ret:
|
||||
continue
|
||||
if 1 <= t[0]:
|
||||
if Map[t[0] - 1][t[1]]:
|
||||
temp.append((t[0] - 1, t[1]))
|
||||
if t[0] < M - 1:
|
||||
if Map[t[0] + 1][t[1]]:
|
||||
temp.append((t[0] + 1, t[1]))
|
||||
if 1 <= t[1]:
|
||||
if Map[t[0]][t[1] - 1]:
|
||||
temp.append((t[0], t[1] - 1))
|
||||
if t[1] < N - 1:
|
||||
if Map[t[0]][t[1] + 1]:
|
||||
temp.append((t[0], t[1] + 1))
|
||||
ret.append(t)
|
||||
return ret
|
||||
|
||||
|
||||
def solve(M, N, Ks):
|
||||
Map = [[0 for _ in range(N)] for _ in range(M)]
|
||||
count = 0
|
||||
found = {}
|
||||
for k in Ks:
|
||||
Map[k[0]][k[1]] = 1
|
||||
|
||||
for i in range(M):
|
||||
for j in range(N):
|
||||
if Map[i][j]:
|
||||
if (i, j) in found:
|
||||
continue
|
||||
else:
|
||||
r = find_group(Map, M, N, i, j)
|
||||
count += 1
|
||||
for s in r:
|
||||
found[s] = count
|
||||
return count
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
T = int(input())
|
||||
for _ in range(T):
|
||||
M, N, K = map(int, input().split())
|
||||
Ks = [tuple(map(int, input().split())) for _ in range(K)]
|
||||
print(solve(M, N, Ks))
|
||||
4
zeta/py/completed/10171.py
Normal file
4
zeta/py/completed/10171.py
Normal file
@@ -0,0 +1,4 @@
|
||||
print("""\ /\\
|
||||
) ( ')
|
||||
( / )
|
||||
\(__)|""")
|
||||
32
zeta/py/completed/1018.py
Normal file
32
zeta/py/completed/1018.py
Normal file
@@ -0,0 +1,32 @@
|
||||
N, M = map(int, input().split())
|
||||
T = [input() for i in range(N)]
|
||||
Min = 10000000000000
|
||||
|
||||
for i in range(N-7):
|
||||
for j in range(M-7):
|
||||
temp = [t[j:j+8] for t in T[i:i+8]]
|
||||
start = temp[0][0]
|
||||
|
||||
C = 0
|
||||
ifC = 0
|
||||
for ki, k in enumerate(range(8)):
|
||||
for l in range(k+1):
|
||||
if ki%2 == 0:
|
||||
C += temp[k-l][l].count("B")
|
||||
ifC += temp[k-l][l].count("W")
|
||||
else:
|
||||
C += temp[k-l][l].count("W")
|
||||
ifC += temp[k-l][l].count("B")
|
||||
for ki, k in enumerate(range(7)):
|
||||
for l in range(k+1):
|
||||
if ki%2 == 0:
|
||||
C += temp[l-k+7][7-l] .count("B")
|
||||
ifC += temp[l-k+7][7-l] .count("W")
|
||||
else:
|
||||
C += temp[l-k+7][7-l] .count("W")
|
||||
ifC += temp[l-k+7][7-l] .count("B")
|
||||
|
||||
mine = min(C, ifC)
|
||||
if mine < Min:
|
||||
Min = mine
|
||||
print(Min)
|
||||
35
zeta/py/completed/1025.py
Normal file
35
zeta/py/completed/1025.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
# 제곱수
|
||||
def check_square(x):
|
||||
return (x ** (1 / 2)).is_integer()
|
||||
|
||||
|
||||
def solve(N: int, M: int, I: list[list[str]]) -> int: # length
|
||||
maxed = -1
|
||||
# 전탐색
|
||||
for n in range(N):
|
||||
for m in range(M):
|
||||
for dn in range(-N, N):
|
||||
for dm in range(-M, M):
|
||||
if dn == 0 and dm == 0:
|
||||
continue
|
||||
s = ''
|
||||
start = [n, m]
|
||||
while 0 <= start[0] < N and 0 <= start[1] < M:
|
||||
s += I[start[0]][start[1]]
|
||||
if check_square(int(s)):
|
||||
maxed = max(maxed, int(s))
|
||||
start[0] += dn
|
||||
start[1] += dm
|
||||
|
||||
return maxed
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
N, M = map(int, input().split())
|
||||
I = [list(map(str, input().rstrip())) for i in range(N)]
|
||||
print(solve(N, M, I))
|
||||
4
zeta/py/completed/10250.py
Normal file
4
zeta/py/completed/10250.py
Normal file
@@ -0,0 +1,4 @@
|
||||
T = int(input())
|
||||
for i in range(T):
|
||||
H, W, N = map(int, input().split())
|
||||
print("%d%02d"%((N-1)%H+1,(N-1)//H+1))
|
||||
13
zeta/py/completed/1032.py
Normal file
13
zeta/py/completed/1032.py
Normal file
@@ -0,0 +1,13 @@
|
||||
N = int(input())
|
||||
K = [input() for i in range(N)]
|
||||
shared = K[0]
|
||||
|
||||
for k in K:
|
||||
for i, c in enumerate(k):
|
||||
if c == "?":
|
||||
pass
|
||||
elif shared[i] == c:
|
||||
pass
|
||||
else:
|
||||
shared = shared[:i] + "?" + shared[i + 1:]
|
||||
print(shared)
|
||||
36
zeta/py/completed/1036.py
Normal file
36
zeta/py/completed/1036.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
|
||||
N = int(input())
|
||||
S = [input() for i in range(N)]
|
||||
K = int(input())
|
||||
|
||||
|
||||
def change(s):
|
||||
return int(s, 36)
|
||||
|
||||
|
||||
def nofet(i):
|
||||
if i <= 9:
|
||||
return chr(i + 48)
|
||||
else:
|
||||
return chr(i + 55)
|
||||
|
||||
|
||||
def rechange(i):
|
||||
s = ""
|
||||
if i == 0:
|
||||
return "0"
|
||||
while i > 0:
|
||||
s += nofet(i % 36)
|
||||
i //= 36
|
||||
return s[::-1]
|
||||
|
||||
|
||||
mult = [[0, i] for i in range(36)]
|
||||
|
||||
for s in S:
|
||||
for i, c in enumerate(s[::-1]):
|
||||
mult[change(c)][0] += 36 ** i
|
||||
|
||||
mult.sort(key=lambda M: M[0] * (35 - M[1]))
|
||||
print(rechange(sum([mult[i][0] * mult[i][1] for i in range(36 - K)] + [mult[i][0] * 35 for i in range(36 - K, 36)])))
|
||||
3
zeta/py/completed/1037.py
Normal file
3
zeta/py/completed/1037.py
Normal file
@@ -0,0 +1,3 @@
|
||||
input()
|
||||
I = sorted(map(int, input().split()))
|
||||
print(I[0] * I[-1])
|
||||
37
zeta/py/completed/1043.py
Normal file
37
zeta/py/completed/1043.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
def solve(N, M, know: set[int], parties):
|
||||
valid_party = [1 for _ in parties]
|
||||
|
||||
flag = True
|
||||
|
||||
while flag:
|
||||
flag = False
|
||||
for i, p in enumerate(parties):
|
||||
cond = [m in know for m in p]
|
||||
if all(cond):
|
||||
valid_party[i] = 0
|
||||
elif any(cond):
|
||||
flag = True
|
||||
valid_party[i] = 0
|
||||
for m in p:
|
||||
know.add(m)
|
||||
|
||||
return sum(valid_party)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
N, M = map(int, input().split())
|
||||
know = set()
|
||||
|
||||
pre_know = list(map(int, input().split()))
|
||||
L = pre_know[0]
|
||||
for i in pre_know[1:]:
|
||||
know.add(i)
|
||||
|
||||
parties = [list(map(int, input().split()))[1:] for _ in range(M)]
|
||||
|
||||
print(solve(N, M, know, parties))
|
||||
28
zeta/py/completed/10431.py
Normal file
28
zeta/py/completed/10431.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
def solve(A: list[int]):
|
||||
A.reverse()
|
||||
B = []
|
||||
cnt = 0
|
||||
while A:
|
||||
a = A.pop()
|
||||
l = len(B)
|
||||
for i, b in enumerate(B):
|
||||
if b > a:
|
||||
B.insert(i, a)
|
||||
cnt += l - i
|
||||
break
|
||||
else:
|
||||
B.append(a)
|
||||
|
||||
return cnt
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
T = int(input())
|
||||
for _ in range(T):
|
||||
t, *A = map(int, input().split())
|
||||
print(t, solve(A))
|
||||
8
zeta/py/completed/1065.py
Normal file
8
zeta/py/completed/1065.py
Normal file
@@ -0,0 +1,8 @@
|
||||
a = int(input())
|
||||
r = 0
|
||||
k = []
|
||||
for i in range(1, a+1):
|
||||
k = tuple(map(int, str(i)))
|
||||
if sum(k) == len(k)*(k[0] + k[-1]) / 2:
|
||||
r += 1
|
||||
print(r)
|
||||
3
zeta/py/completed/10699.py
Normal file
3
zeta/py/completed/10699.py
Normal file
@@ -0,0 +1,3 @@
|
||||
import datetime
|
||||
|
||||
print(datetime.date.today().isoformat())
|
||||
41
zeta/py/completed/1071.py
Normal file
41
zeta/py/completed/1071.py
Normal file
@@ -0,0 +1,41 @@
|
||||
def continuous(a, b):
|
||||
return a + 1 == b
|
||||
|
||||
|
||||
def solve(N: int, S: list[int]):
|
||||
x = []
|
||||
spares = []
|
||||
nums = list(S)
|
||||
nums.sort()
|
||||
|
||||
x.append(nums[0])
|
||||
for n in nums[1:]:
|
||||
if continuous(x[-1], n):
|
||||
spares.append(n)
|
||||
else:
|
||||
x.append(n)
|
||||
while spares:
|
||||
if not continuous(x[-1], spares[0]):
|
||||
x.append(spares.pop(0))
|
||||
else:
|
||||
break
|
||||
|
||||
if spares:
|
||||
k = -1
|
||||
l = len(x)
|
||||
while spares:
|
||||
if -l == k:
|
||||
x.insert(0, spares.pop(0))
|
||||
continue
|
||||
if continuous(spares[0], x[k]) or continuous(x[k - 1], spares[0]):
|
||||
k -= 1
|
||||
else:
|
||||
x.insert(k, spares.pop(0))
|
||||
|
||||
return x
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
N = int(input())
|
||||
S = list(map(int, input().split()))
|
||||
print(" ".join(map(str, solve(N, S))))
|
||||
10
zeta/py/completed/1074.py
Normal file
10
zeta/py/completed/1074.py
Normal file
@@ -0,0 +1,10 @@
|
||||
N, r, c = map(int, input().split())
|
||||
|
||||
Z = lambda r, c: r * 2 + c
|
||||
|
||||
S = 0
|
||||
|
||||
for i in range(N - 1, -1, -1):
|
||||
S += (4 ** i) * Z(r // (2 ** i), c // (2 ** i))
|
||||
r, c = r % (2 ** i), c % (2 ** i)
|
||||
print(S)
|
||||
13
zeta/py/completed/1076.py
Normal file
13
zeta/py/completed/1076.py
Normal file
@@ -0,0 +1,13 @@
|
||||
VALUE = {
|
||||
"black": 0,
|
||||
"brown": 1,
|
||||
"red": 2,
|
||||
"orange":3,
|
||||
"yellow":4,
|
||||
"green": 5,
|
||||
"blue": 6,
|
||||
"violet": 7,
|
||||
"grey": 8,
|
||||
"white": 9}
|
||||
|
||||
print((10*VALUE[input()] + VALUE[input()])*10**VALUE[input()])
|
||||
13
zeta/py/completed/10773.py
Normal file
13
zeta/py/completed/10773.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def solve(K, I):
|
||||
stack = list()
|
||||
for i in I:
|
||||
if i:
|
||||
stack.append(i)
|
||||
else:
|
||||
stack.pop()
|
||||
return sum(stack)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
K = int(input())
|
||||
print(solve(K, [int(input()) for _ in range(K)]))
|
||||
8
zeta/py/completed/10807.py
Normal file
8
zeta/py/completed/10807.py
Normal file
@@ -0,0 +1,8 @@
|
||||
N = int(input())
|
||||
L = list(map(int, input().split()))
|
||||
v = int(input())
|
||||
c = 0
|
||||
for x in L:
|
||||
if x == v:
|
||||
c += 1
|
||||
print(c)
|
||||
9
zeta/py/completed/10809.py
Normal file
9
zeta/py/completed/10809.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from sys import *
|
||||
c=0
|
||||
D=[]
|
||||
I=[ord(i)-97 for i in stdin.readline().rstrip()]
|
||||
for i in range(26):
|
||||
try:D.append(I.index(i))
|
||||
except:D.append(-1)
|
||||
D=list(map(str,D))
|
||||
print(" ".join(D))
|
||||
8
zeta/py/completed/10810.py
Normal file
8
zeta/py/completed/10810.py
Normal file
@@ -0,0 +1,8 @@
|
||||
N, M = map(int, input().split())
|
||||
L = [0 for _ in range(N)]
|
||||
for _ in range(M):
|
||||
i, j, k = map(int, input().split())
|
||||
for m in range(i - 1, j):
|
||||
L[m] = k
|
||||
|
||||
print(" ".join(map(str, L)))
|
||||
7
zeta/py/completed/10811.py
Normal file
7
zeta/py/completed/10811.py
Normal file
@@ -0,0 +1,7 @@
|
||||
N, M = map(int, input().split())
|
||||
L = [i + 1 for i in range(N)]
|
||||
for _ in range(M):
|
||||
i, j = map(int, input().split())
|
||||
L[i - 1:j] = reversed(L[i - 1:j])
|
||||
|
||||
print(" ".join(map(str, L)))
|
||||
14
zeta/py/completed/10813.py
Normal file
14
zeta/py/completed/10813.py
Normal file
@@ -0,0 +1,14 @@
|
||||
N, M = map(int, input().split())
|
||||
L = [i for i in range(1, N + 1)]
|
||||
|
||||
|
||||
def swap(i, j):
|
||||
global L
|
||||
L[i - 1], L[j - 1] = L[j - 1], L[i - 1]
|
||||
|
||||
|
||||
for _ in range(M):
|
||||
i, j = map(int, input().split())
|
||||
swap(i, j)
|
||||
|
||||
print(" ".join(map(str, L)))
|
||||
2
zeta/py/completed/10814.py
Normal file
2
zeta/py/completed/10814.py
Normal file
@@ -0,0 +1,2 @@
|
||||
N = int(input())
|
||||
for s in sorted([tuple(map(str, input().split())) for i in range(N)], key=lambda v: int(v[0])): print(s[0], s[1])
|
||||
9
zeta/py/completed/10816.py
Normal file
9
zeta/py/completed/10816.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from collections import Counter
|
||||
|
||||
if __name__ == "__main__":
|
||||
N = int(input())
|
||||
S = list(map(int, input().split()))
|
||||
counter = Counter(S)
|
||||
M = int(input())
|
||||
I = list(map(int, input().split()))
|
||||
print(" ".join(str(counter[i]) for i in I))
|
||||
3
zeta/py/completed/10818.py
Normal file
3
zeta/py/completed/10818.py
Normal file
@@ -0,0 +1,3 @@
|
||||
input()
|
||||
A = list(map(int, input().split() ) )
|
||||
print(min(A), max(A))
|
||||
32
zeta/py/completed/10828.py
Normal file
32
zeta/py/completed/10828.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import sys
|
||||
|
||||
|
||||
class Stack(list):
|
||||
def push(self, *args, **kwargs):
|
||||
self.append(args[0])
|
||||
|
||||
def size(self, *args, **kwargs):
|
||||
return self.__len__()
|
||||
|
||||
def empty(self, *args, **kwargs):
|
||||
return 1 if self.__len__() == 0 else 0
|
||||
|
||||
def top(self, *args, **kwargs):
|
||||
return self.__getitem__(-1)
|
||||
|
||||
def dispatch(self, exp):
|
||||
t = exp.strip().split()
|
||||
try:
|
||||
return self.__getattribute__(t[0])(*map(int, t[1:]))
|
||||
except:
|
||||
return -1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
s = Stack()
|
||||
N = int(sys.stdin.readline())
|
||||
for i in range(N):
|
||||
exp = sys.stdin.readline()
|
||||
ret = s.dispatch(exp)
|
||||
if ret is not None:
|
||||
print(ret)
|
||||
20
zeta/py/completed/10844.py
Normal file
20
zeta/py/completed/10844.py
Normal file
@@ -0,0 +1,20 @@
|
||||
N = int(input())
|
||||
|
||||
Mem = [[0] * 10 for i in range(100)]
|
||||
|
||||
|
||||
def I(l, k):
|
||||
if 0 <= k <= 9:
|
||||
if l == 1:
|
||||
return 1
|
||||
elif Mem[l-1][k] != 0:
|
||||
return Mem[l-1][k]
|
||||
else:
|
||||
temp = (I(l - 1, k - 1) + I(l - 1, k + 1)) % 1000000000
|
||||
Mem[l-1][k] = temp
|
||||
return temp
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
print(sum(I(N, i) for i in range(1, 10)) % 1000000000)
|
||||
36
zeta/py/completed/10845.py
Normal file
36
zeta/py/completed/10845.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
from collections import deque
|
||||
|
||||
queue = deque()
|
||||
|
||||
|
||||
def dispatch(command: str, *args):
|
||||
if command == "push":
|
||||
queue.append(int(args[0]))
|
||||
elif command == "pop":
|
||||
if queue:
|
||||
return queue.popleft()
|
||||
else:
|
||||
return -1
|
||||
elif command == "size":
|
||||
return len(queue)
|
||||
elif command == "empty":
|
||||
return 0 if queue else 1
|
||||
elif command == "front":
|
||||
if queue:
|
||||
return queue[0]
|
||||
else:
|
||||
return -1
|
||||
elif command == "back":
|
||||
if queue:
|
||||
return queue[-1]
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
N = int(sys.stdin.readline())
|
||||
for _ in range(N):
|
||||
d = dispatch(*sys.stdin.readline().strip().split())
|
||||
if d is not None:
|
||||
print(d)
|
||||
9
zeta/py/completed/10870.py
Normal file
9
zeta/py/completed/10870.py
Normal file
@@ -0,0 +1,9 @@
|
||||
def fib(n):
|
||||
if not n:
|
||||
return 0
|
||||
elif n == 1:
|
||||
return 1
|
||||
else:
|
||||
return fib(n-1) + fib(n-2)
|
||||
|
||||
print(fib(int(input())))
|
||||
2
zeta/py/completed/10895.py
Normal file
2
zeta/py/completed/10895.py
Normal file
@@ -0,0 +1,2 @@
|
||||
a, k = map(int, input().split())
|
||||
print(1 if a == 1 else (a if k == 0 else (a if a % 2 else 1)))
|
||||
15
zeta/py/completed/10899.py
Normal file
15
zeta/py/completed/10899.py
Normal file
@@ -0,0 +1,15 @@
|
||||
if __name__ == "__main__":
|
||||
P, N = map(int, input().split())
|
||||
S = list(map(int, input().split()))
|
||||
S.sort(reverse=True)
|
||||
I = []
|
||||
P -= 1
|
||||
for _ in range(N):
|
||||
s = S.pop()
|
||||
if P - s < 0:
|
||||
break
|
||||
else:
|
||||
I.append(P)
|
||||
P -= s
|
||||
|
||||
print(len(I), sum(I))
|
||||
1
zeta/py/completed/10926.py
Normal file
1
zeta/py/completed/10926.py
Normal file
@@ -0,0 +1 @@
|
||||
print(input()+"??!")
|
||||
44
zeta/py/completed/10942.py
Normal file
44
zeta/py/completed/10942.py
Normal file
@@ -0,0 +1,44 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
class Palindrome:
|
||||
def __init__(self, N: int, arr: list[int]):
|
||||
self.N = N
|
||||
self.arr = arr
|
||||
self.P = [[0 for _ in range(N)] for _ in range(N)]
|
||||
|
||||
for i in range(self.N):
|
||||
s = i
|
||||
e = i
|
||||
while 0 <= s and e < self.N:
|
||||
if self.arr[s] == self.arr[e]:
|
||||
self.P[s][e] = 1
|
||||
else:
|
||||
break
|
||||
s -= 1
|
||||
e += 1
|
||||
|
||||
for i in range(self.N - 1):
|
||||
s = i
|
||||
e = i + 1
|
||||
while 0 <= s and e < self.N:
|
||||
if self.arr[s] == self.arr[e]:
|
||||
self.P[s][e] = 1
|
||||
else:
|
||||
break
|
||||
s -= 1
|
||||
e += 1
|
||||
|
||||
def is_partial_valid(self, s: int, e: int) -> int:
|
||||
return self.P[s][e]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
N = int(input())
|
||||
arr = list(map(int, input().split()))
|
||||
solver = Palindrome(N, arr)
|
||||
M = int(input())
|
||||
for s, e in [tuple(map(lambda x: int(x) - 1, input().split())) for _ in range(M)]:
|
||||
print(solver.is_partial_valid(s, e))
|
||||
10
zeta/py/completed/10950.py
Normal file
10
zeta/py/completed/10950.py
Normal file
@@ -0,0 +1,10 @@
|
||||
N = range(int(input()))
|
||||
[print(
|
||||
sum(
|
||||
map(
|
||||
int,input().split()
|
||||
)
|
||||
)
|
||||
)
|
||||
for i in N
|
||||
]
|
||||
5
zeta/py/completed/10951.py
Normal file
5
zeta/py/completed/10951.py
Normal file
@@ -0,0 +1,5 @@
|
||||
while 1:
|
||||
try:
|
||||
print(sum(map(int,input().split())))
|
||||
except EOFError:
|
||||
break
|
||||
5
zeta/py/completed/10952.py
Normal file
5
zeta/py/completed/10952.py
Normal file
@@ -0,0 +1,5 @@
|
||||
while True:
|
||||
s = sum(map(int, input().split()))
|
||||
if s == 0:
|
||||
break
|
||||
print(s)
|
||||
17
zeta/py/completed/10986.py
Normal file
17
zeta/py/completed/10986.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
import math
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
if __name__ == "__main__":
|
||||
N, M = map(int, input().split())
|
||||
A = list(map(int, input().split()))
|
||||
S = [(0, 0)]
|
||||
C = [0] * 1001
|
||||
C[0] = 1
|
||||
for i in range(N):
|
||||
s = ((S[-1][0] + A[i]) % M, i + 1)
|
||||
S.append(s)
|
||||
C[s[0]] += 1
|
||||
|
||||
print(sum([math.comb(c, 2) for c in C]))
|
||||
1
zeta/py/completed/10988.py
Normal file
1
zeta/py/completed/10988.py
Normal file
@@ -0,0 +1 @@
|
||||
I=input();print(1 if I == I[::-1] else 0)
|
||||
8
zeta/py/completed/10989.py
Normal file
8
zeta/py/completed/10989.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import sys
|
||||
N = int(sys.stdin.readline())
|
||||
K = [0]*10000
|
||||
for i in range(N):
|
||||
K[int(sys.stdin.readline())-1] += 1
|
||||
for i in range(1,10001):
|
||||
for k in range(K[i-1]):
|
||||
print(i)
|
||||
14
zeta/py/completed/10996.py
Normal file
14
zeta/py/completed/10996.py
Normal file
@@ -0,0 +1,14 @@
|
||||
N = int(input())
|
||||
for i in range(N):
|
||||
for j in range(N):
|
||||
if j % 2 == 0:
|
||||
print("*", end='')
|
||||
else:
|
||||
print(" ", end='')
|
||||
print()
|
||||
for j in range(N):
|
||||
if j % 2 == 1:
|
||||
print("*", end='')
|
||||
else:
|
||||
print(" ", end='')
|
||||
print()
|
||||
23
zeta/py/completed/11000.py
Normal file
23
zeta/py/completed/11000.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import sys
|
||||
import heapq
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
def solve(N, Cl):
|
||||
Cl.sort()
|
||||
|
||||
pq = []
|
||||
heapq.heappush(pq, Cl[0][1])
|
||||
for i in range(1, N):
|
||||
if pq[0] <= Cl[i][0]:
|
||||
heapq.heappop(pq)
|
||||
heapq.heappush(pq, Cl[i][1])
|
||||
|
||||
return len(pq)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
N = int(input())
|
||||
Cl = [tuple(map(int, input().split())) for _ in range(N)]
|
||||
print(solve(N, Cl))
|
||||
3
zeta/py/completed/11021.py
Normal file
3
zeta/py/completed/11021.py
Normal file
@@ -0,0 +1,3 @@
|
||||
N = int(input())
|
||||
for i in range(N):
|
||||
print("Case #%s:"%(i+1), sum(map(int, input().split())))
|
||||
17
zeta/py/completed/11047.py
Normal file
17
zeta/py/completed/11047.py
Normal file
@@ -0,0 +1,17 @@
|
||||
N, K = map(int, input().split())
|
||||
A = [int(input())for i in range(N)]
|
||||
|
||||
r = 0
|
||||
back = 1
|
||||
|
||||
while K != 0:
|
||||
for i in A:
|
||||
if i > K:
|
||||
r += K // back
|
||||
K %= back
|
||||
break
|
||||
back = i
|
||||
else:
|
||||
r += K // back
|
||||
K %= back
|
||||
print(r)
|
||||
13
zeta/py/completed/11050.py
Normal file
13
zeta/py/completed/11050.py
Normal file
@@ -0,0 +1,13 @@
|
||||
N, K = map(int, input().split())
|
||||
|
||||
|
||||
def C(n, k):
|
||||
if n == 1:
|
||||
return 1
|
||||
elif k == 0 or k == n:
|
||||
return 1
|
||||
else:
|
||||
return C(n - 1, k) + C(n - 1, k - 1)
|
||||
|
||||
|
||||
print(C(N, K))
|
||||
17
zeta/py/completed/11051.py
Normal file
17
zeta/py/completed/11051.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import sys
|
||||
sys.setrecursionlimit(12000)
|
||||
N, K = map(int, input().split())
|
||||
Mem = [[0]*1001for i in range(1001)]
|
||||
|
||||
def C(n, k):
|
||||
if n == 1:
|
||||
return 1
|
||||
elif k == 0 or k == n:
|
||||
return 1
|
||||
if Mem[n][k] != 0:
|
||||
return Mem[n][k]
|
||||
t = (C(n - 1, k) + C(n - 1, k - 1)) % 10007
|
||||
Mem[n][k] = t
|
||||
return t
|
||||
|
||||
print(C(N, K))
|
||||
15
zeta/py/completed/11053.py
Normal file
15
zeta/py/completed/11053.py
Normal file
@@ -0,0 +1,15 @@
|
||||
N = int(input())
|
||||
A = list(map(int, input().split()))
|
||||
|
||||
T = [0 for _ in range(N)]
|
||||
T[0] = 1
|
||||
|
||||
for i in range(1, N):
|
||||
t = []
|
||||
for j in range(i):
|
||||
if A[j] < A[i]:
|
||||
t.append(T[j] + 1)
|
||||
else:
|
||||
t.append(1)
|
||||
T[i] = max(t)
|
||||
print(max(T))
|
||||
27
zeta/py/completed/11054.py
Normal file
27
zeta/py/completed/11054.py
Normal file
@@ -0,0 +1,27 @@
|
||||
def solve(N: int, A: list):
|
||||
T = [[0, 0] for _ in range(N)]
|
||||
T[0][0] = 1 # 상승부
|
||||
T[0][1] = 1 # 하강부
|
||||
|
||||
for i in range(1, N): # mainloop
|
||||
t = []
|
||||
for j in range(i):
|
||||
if A[j] < A[i]:
|
||||
t.append(T[j][0] + 1)
|
||||
else:
|
||||
t.append(1)
|
||||
T[i][0] = max(t)
|
||||
|
||||
t = []
|
||||
for j in range(i):
|
||||
if A[j] > A[i]:
|
||||
t.append(T[j][0] + 1)
|
||||
t.append(T[j][1] + 1)
|
||||
else:
|
||||
t.append(1)
|
||||
T[i][1] = max(t)
|
||||
return max(max(T, key=lambda x: max(x)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(solve(int(input()), list(map(int, input().split()))))
|
||||
32
zeta/py/completed/1107.py
Normal file
32
zeta/py/completed/1107.py
Normal file
@@ -0,0 +1,32 @@
|
||||
class RemoteController:
|
||||
"""
|
||||
start at number 100
|
||||
action:
|
||||
press number not broken
|
||||
press ++
|
||||
press --
|
||||
|
||||
example(5457 with broken 6 7 8):
|
||||
5 4 5 5 + +
|
||||
"""
|
||||
|
||||
def __init__(self, broken: list[int]):
|
||||
self.broken = broken
|
||||
|
||||
def solve(self, target: int) -> int:
|
||||
"""return: number of press buttons to reach target number"""
|
||||
mins = abs(target - 100)
|
||||
for i in range(0, 1000000 + 1):
|
||||
nums = list(map(int, str(i)))
|
||||
if all(False if s in self.broken else True for s in nums):
|
||||
mins = min(abs(target - i) + len(nums), mins)
|
||||
|
||||
return mins
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
N = int(input())
|
||||
M = int(input())
|
||||
broken = list(map(int, input().split())) if M != 0 else []
|
||||
solver = RemoteController(broken)
|
||||
print(solver.solve(N))
|
||||
12
zeta/py/completed/1120.py
Normal file
12
zeta/py/completed/1120.py
Normal file
@@ -0,0 +1,12 @@
|
||||
A, B = input().split()
|
||||
|
||||
|
||||
def get(a, b):
|
||||
cnt = 0
|
||||
for f, s in zip(a, b):
|
||||
if f != s:
|
||||
cnt += 1
|
||||
return cnt
|
||||
|
||||
|
||||
print(min(get(A, B[i:i+len(A)+1]) for i in range(len(B) - len(A)+1)))
|
||||
6
zeta/py/completed/11365.py
Normal file
6
zeta/py/completed/11365.py
Normal file
@@ -0,0 +1,6 @@
|
||||
while True:
|
||||
i = input()
|
||||
if i == 'END':
|
||||
break
|
||||
i = i[::-1]
|
||||
print(i)
|
||||
1
zeta/py/completed/11382.py
Normal file
1
zeta/py/completed/11382.py
Normal file
@@ -0,0 +1 @@
|
||||
print(sum(map(int,input().split())))
|
||||
12
zeta/py/completed/11399.py
Normal file
12
zeta/py/completed/11399.py
Normal file
@@ -0,0 +1,12 @@
|
||||
def solve(N, P):
|
||||
P.sort()
|
||||
S = P[0]
|
||||
before = P[0]
|
||||
for p in P[1:]:
|
||||
S += before + p
|
||||
before += p
|
||||
return S
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(solve(int(input()), list(map(int, input().split()))))
|
||||
12
zeta/py/completed/1149.py
Normal file
12
zeta/py/completed/1149.py
Normal file
@@ -0,0 +1,12 @@
|
||||
N = int(input())
|
||||
C = [list(map(int, input().split())) for _ in range(N)]
|
||||
|
||||
T = [[0, 0, 0] for i in range(N)]
|
||||
T[0] = C[0][:]
|
||||
|
||||
for i in range(1, N):
|
||||
T[i][0] = min((T[i - 1][1], T[i - 1][2])) + C[i][0]
|
||||
T[i][1] = min((T[i - 1][0], T[i - 1][2])) + C[i][1]
|
||||
T[i][2] = min((T[i - 1][0], T[i - 1][1])) + C[i][2]
|
||||
|
||||
print(min((T[N-1][0], T[N-1][1], T[N-1][2])))
|
||||
29
zeta/py/completed/11501.py
Normal file
29
zeta/py/completed/11501.py
Normal file
@@ -0,0 +1,29 @@
|
||||
def solve(N, P):
|
||||
s = 0
|
||||
r, a = partition(P)
|
||||
s += a
|
||||
while (r):
|
||||
r, a = partition(r)
|
||||
s += a
|
||||
return s
|
||||
|
||||
|
||||
def partition(part: list):
|
||||
max_p = max(part)
|
||||
|
||||
m_idx = 0
|
||||
for i in range(len(part)):
|
||||
if part[i] == max_p:
|
||||
m_idx = i
|
||||
remain = part[m_idx + 1:]
|
||||
after = part[:m_idx]
|
||||
amount = sum([max_p - v for v in after])
|
||||
return remain, amount
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
T = int(input())
|
||||
for _ in range(T):
|
||||
N = int(input())
|
||||
P = list(map(int, input().split()))
|
||||
print(solve(N, P))
|
||||
1
zeta/py/completed/11506.py
Normal file
1
zeta/py/completed/11506.py
Normal file
@@ -0,0 +1 @@
|
||||
print("<EFBFBD>")
|
||||
17
zeta/py/completed/11509.py
Normal file
17
zeta/py/completed/11509.py
Normal file
@@ -0,0 +1,17 @@
|
||||
def solve(N, H):
|
||||
lasts = []
|
||||
for i, h in enumerate(H):
|
||||
for j, l in enumerate(lasts):
|
||||
if h == l - 1:
|
||||
lasts[j] -= 1
|
||||
break
|
||||
else:
|
||||
lasts.append(h)
|
||||
|
||||
return len(lasts)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
N = int(input())
|
||||
H = list(map(int, input().split()))
|
||||
print(solve(N, H))
|
||||
13
zeta/py/completed/11509_faster.py
Normal file
13
zeta/py/completed/11509_faster.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def solve(N, H):
|
||||
arrow = [0] * 1000001
|
||||
for h in H:
|
||||
if arrow[h]:
|
||||
arrow[h] -= 1
|
||||
arrow[h - 1] += 1
|
||||
return sum(arrow)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
N = int(input())
|
||||
H = list(map(int, input().split()))
|
||||
print(solve(N, H))
|
||||
11
zeta/py/completed/11536.py
Normal file
11
zeta/py/completed/11536.py
Normal file
@@ -0,0 +1,11 @@
|
||||
if __name__ == "__main__":
|
||||
N = int(input())
|
||||
I = [input() for _ in range(N)]
|
||||
I_a = sorted(I)
|
||||
I_d = I_a.copy()[::-1]
|
||||
if I == I_a:
|
||||
print("INCREASING")
|
||||
elif I == I_d:
|
||||
print("DECREASING")
|
||||
else:
|
||||
print("NEITHER")
|
||||
3
zeta/py/completed/11650.py
Normal file
3
zeta/py/completed/11650.py
Normal file
@@ -0,0 +1,3 @@
|
||||
N = int(input())
|
||||
for i in sorted([list(map(int,input().split()))for i in range(N)]):
|
||||
print(' '.join(map(str, i)))
|
||||
3
zeta/py/completed/11651.py
Normal file
3
zeta/py/completed/11651.py
Normal file
@@ -0,0 +1,3 @@
|
||||
T = int(input())
|
||||
S = [tuple(map(int, input().split()))for _ in range(T)]; S.sort(key=lambda v: (v[1], v[0]))
|
||||
[print(i, j)for i, j in S]
|
||||
12
zeta/py/completed/11653.py
Normal file
12
zeta/py/completed/11653.py
Normal file
@@ -0,0 +1,12 @@
|
||||
N = int(input())
|
||||
p = 2
|
||||
while N % p == 0:
|
||||
N //= p
|
||||
print(p)
|
||||
p += 1
|
||||
while N != 1:
|
||||
if N % p == 0:
|
||||
N //= p
|
||||
print(p)
|
||||
else:
|
||||
p += 2
|
||||
6
zeta/py/completed/11656.py
Normal file
6
zeta/py/completed/11656.py
Normal file
@@ -0,0 +1,6 @@
|
||||
I = input()
|
||||
T = set()
|
||||
for i in range(len(I)):
|
||||
T.add(I[i:])
|
||||
for t in sorted(T):
|
||||
print(t)
|
||||
13
zeta/py/completed/11659.py
Normal file
13
zeta/py/completed/11659.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
if __name__ == "__main__":
|
||||
N, M = map(int, input().split())
|
||||
A = list(map(int, input().split()))
|
||||
S = [0]
|
||||
for i in range(N):
|
||||
S.append(S[-1] + A[i])
|
||||
for _ in range(M):
|
||||
i, j = map(int, input().split())
|
||||
print(S[j] - S[i - 1])
|
||||
16
zeta/py/completed/11660.py
Normal file
16
zeta/py/completed/11660.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
if __name__ == "__main__":
|
||||
N, M = map(int, input().split())
|
||||
A = [list(map(int, input().split())) for _ in range(N)]
|
||||
|
||||
S = [[0 for _ in range(N + 1)] for _ in range(N + 1)]
|
||||
for i in range(N):
|
||||
for j in range(N):
|
||||
S[i + 1][j + 1] = S[i][j + 1] + S[i + 1][j] - S[i][j] + A[i][j]
|
||||
|
||||
for _ in range(M):
|
||||
x1, y1, x2, y2 = map(int, input().split())
|
||||
print(S[x2][y2] - S[x2][y1 - 1] - S[x1 - 1][y2] + S[x1 - 1][y1 - 1])
|
||||
47
zeta/py/completed/1167.py
Normal file
47
zeta/py/completed/1167.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
def longest(E, start) -> tuple[int, int]:
|
||||
D = []
|
||||
|
||||
M = 0
|
||||
V_M = 0
|
||||
D.append((start, [start], 0)) # now, visited, accumulated
|
||||
|
||||
while D:
|
||||
now, visited, accumulated = D.pop(0)
|
||||
flag = True
|
||||
for e in E[now]:
|
||||
target, cost = e[0], e[1]
|
||||
if target not in visited:
|
||||
flag = False
|
||||
D.append((target, visited + [target], cost + accumulated))
|
||||
|
||||
if flag:
|
||||
if accumulated > M:
|
||||
M = accumulated
|
||||
V_M = now
|
||||
|
||||
return V_M, M
|
||||
|
||||
|
||||
def solve(V, E):
|
||||
first = longest(E, 1)[0]
|
||||
_, diameter = longest(E, first)
|
||||
|
||||
return diameter
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
V = int(input())
|
||||
E = {}
|
||||
for _ in range(V):
|
||||
_i = list(map(int, input().split()))
|
||||
E[_i[0]] = []
|
||||
|
||||
for i, v in zip(_i[1:-1:2], _i[2:-1:2]):
|
||||
E[_i[0]].append((i, v))
|
||||
|
||||
print(solve(V, E))
|
||||
14
zeta/py/completed/11729.py
Normal file
14
zeta/py/completed/11729.py
Normal file
@@ -0,0 +1,14 @@
|
||||
N = int(input())
|
||||
def move(f, t):
|
||||
print(f, t)
|
||||
|
||||
def hanoi(n, f, b, t):
|
||||
if n == 1:
|
||||
move(f, t)
|
||||
else:
|
||||
hanoi(n-1, f, t, b)
|
||||
move(f, t)
|
||||
hanoi(n-1, b, f, t)
|
||||
|
||||
print(2**N-1)
|
||||
hanoi(N, 1,2,3)
|
||||
6
zeta/py/completed/1181.py
Normal file
6
zeta/py/completed/1181.py
Normal file
@@ -0,0 +1,6 @@
|
||||
N = int(input())
|
||||
S = [input() for i in range(N)]
|
||||
S = list(set(S))
|
||||
S.sort(key=lambda v: (len(v), v))
|
||||
for s in S:
|
||||
print(s)
|
||||
9
zeta/py/completed/1193.py
Normal file
9
zeta/py/completed/1193.py
Normal file
@@ -0,0 +1,9 @@
|
||||
S = lambda n: n*(n+1)//2
|
||||
N = int(input())
|
||||
nor = round((2*N)**.5)
|
||||
t = N - S(nor-1)
|
||||
k = S(nor) - S(nor-1)
|
||||
if nor % 2:
|
||||
print("%d/%d"%(k-t+1, t))
|
||||
else:
|
||||
print("%d/%d"%(t, k-t+1))
|
||||
1
zeta/py/completed/11945.py
Normal file
1
zeta/py/completed/11945.py
Normal file
@@ -0,0 +1 @@
|
||||
for i in range(int(input().split()[0])):print(input()[::-1])
|
||||
5
zeta/py/completed/11966.py
Normal file
5
zeta/py/completed/11966.py
Normal file
@@ -0,0 +1,5 @@
|
||||
d=1;n=int(input())
|
||||
while n>=d:
|
||||
if(n==d):print(1);break
|
||||
d*=2
|
||||
else:print(0)
|
||||
48
zeta/py/completed/1197.py
Normal file
48
zeta/py/completed/1197.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import sys
|
||||
|
||||
input = sys.stdin.readline
|
||||
|
||||
|
||||
class MinimumSpanningTree:
|
||||
def __init__(self, V: int, E: int, edges: list[tuple[int]]):
|
||||
self.V = V
|
||||
self.E = E
|
||||
self.edges: list[tuple[int]] = edges
|
||||
|
||||
self.edges.sort(key=lambda x: x[2])
|
||||
self.__parents = [i for i in range(self.V + 1)]
|
||||
|
||||
def __root(self, x: int) -> int:
|
||||
node = x
|
||||
while node != self.__parents[node]:
|
||||
node = self.__parents[node]
|
||||
return node
|
||||
|
||||
def __union(self, x: int, y: int):
|
||||
rx = self.__root(x)
|
||||
ry = self.__root(y)
|
||||
if rx > ry:
|
||||
self.__parents[ry] = rx
|
||||
else:
|
||||
self.__parents[rx] = ry
|
||||
|
||||
def solve(self):
|
||||
mst = []
|
||||
for e in self.edges:
|
||||
a = e[0]
|
||||
b = e[1]
|
||||
if self.__root(a) == self.__root(b):
|
||||
continue
|
||||
mst.append(e)
|
||||
self.__union(a, b)
|
||||
|
||||
if len(mst) == self.V - 1:
|
||||
break
|
||||
return sum(map(lambda x: x[2], mst))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
V, E = map(int, input().split())
|
||||
edges = [tuple(map(int, input().split())) for _ in range(E)]
|
||||
solver = MinimumSpanningTree(V, E, edges)
|
||||
print(solver.solve())
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user