C

@chanheeko0709

위상정렬.... 인데 너무 어렵다

Python
19 hours ago
from collections import deque v, n = map(int, input().split()) r = [] g = [[] for _ in range(v + 1)] for _ in range(n): r.append(list(map(int,input().split())))

토마토맛토마토맛토마토맛토마토맛토마토맛기러기러기러기러기러기러기러기러기러기러기러기러기맛토마토맛토맛토마토맛기러기러기러기러기맛 연근

Python
2 weeks ago
from collections import deque M, N, H = map(int, input().split()) box = [] q = deque() for h in range(H): floor = [] for i in range(N):

토마토맛토마토맛토마토맛토마토맛토마토맛기러기러기러기러기러기러기러기러기러기러기러기러기맛토마토맛토맛토마토맛기러기러기러기러기맛 연근

Python
3 weeks ago
M,N,H = map(int,input().split()) tomatofarm = []

1

Python
3 weeks ago
n = int(input()) a = [] for i in range(n): a.append(list(map(int, input()))) ans = [] for i in range(n): for j in range(n):

괄호의 값

Python
4 weeks ago
s = input() stack = [] ok = True for c in s: if c == '(' or c == '[': stack.append(c) elif c == ')':

회의를 왜 준비하는 거야 그냥 너희들끼리 알아서 위원회 구성하고 의견나누고 대표 뽑으면 되는 거 잖아 진짜 이런 회의 준비도 못하냐;; 이게 나라고 국회위원이야?!

Python
4 weeks ago
from collections import deque n = int(input()) m = int(input()) g = [[] for _ in range(n + 1)] for _ in range(m): u, v = map(int, input().split()) g[u].append(v) g[v].append(u)

리모컨(bfs)

Python
1 month ago
from collections import deque a,b=map(int,input().split()) vis = [False] * 41 q = deque() q.append((a,0)) vis[a] = True while q:

리모컨

Python
1 month ago
a, b = map(int, input().split()) d = abs(b - a) c = 0 while d > 0: if d >= 10: d -= 10

촌수계산

Python
1 month ago
from collections import deque n = int(input()) a, b = map(int, input().split()) m = int(input()) graph = [[] for _ in range(n + 1)] for i in range(m): x, y = map(int, input().split())

바이러스

Python
2 months ago
n=int(input()) m=int(input()) graph=[[] for _ in range(n+1)] for i in range(m): u,v=map(int,input().split()) graph[u].append(v)

바이러스

Python
2 months ago
from collections import deque n=int(input()) m=int(input()) graph=[[] for _ in range(n+1)] for i in range(m): u,v=map(int,input().split())

1

Python
2 months ago
memo=[[0] * 15 for _ in range(15)] def SuperSum(k,n): result = 0 if k == 0: return n if memo[k][n] != 0: return memo[k][n] for i in range(1,n+1): result += (SuperSum(k-1,i)) memo[k][n] = result

1

Python
2 months ago
def twozinsu(n): if n < 2: print(n,end='') return twozinsu(n // 2) print ((n % 2),end ='') n = int(input()) twozinsu(n)

피보나치

Python
2 months ago
memo = [-1] * 10007 def fibo(N): if N == 1 or N == 2: return 1 if memo[N] != -1: return memo[N] memo[N] = (fibo(N-1) + fibo(N-2)) % 10009 return memo[N]

3704 : 계단오르기 2

Python
3 months ago
import sys sys.setrecursionlimit(100005) memo = [-1]*100005 def climb(n): if n == 0: return 1 elif n == 1: return 1

sub.py

Python
3 months ago
def print_num(n): if n == 0: return print_num(n-1) print(n) n=int(input()) print_num(n)

스택2

Python
6 months ago
N=int(input()) stack = [] for _ in range(N): a= input().split() if a[0] == '1': stack.append(a[1]) elif a[0] == '2': if stack == []: print(-1)

회사에 있는 사람

Python
7 months ago
N = int(input()) company = set() for _ in range(N): name, action = input().split() if action == "enter": company.add(name) else: company.remove(name)

zkem

Python
7 months ago
n=int(input()) cards=set(map(int,input().split())) m=int(input()) targets=map(int,input().split()) for t in targets: if t in cards: print(1, end=' ') else:

섹종ㅇ;ㅣ

Python
7 months ago
n = int(input()) white=[[0] * 100 for _ in range(100)] for i in range(n): x,y=map(int,input().split()) white[x-1][y-1]=1 for a in range(10): white[x+a][y+i]=1 for b in range(10): white[x+i][y+b]=1 print(white[