![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/cTh4q2/btsEFfkbplw/uiamIytpKDKnCAvncOkkv1/img.png)
๋ฌธ์ : ์ฝ๋ : import sys from collections import deque # ๋ฐฉ๋ฌธ : 1 & ๋ฐฉ๋ฌธx : 0 def DFS(V): visited_dfs[V] = 1 print(V, end= ' ') for i in range(1, N+1): if visited_dfs[i] == 0 and graph[V][i]==1: DFS(i) def BFS(V): queue = deque([V]) visited_bfs[V] = 1 while queue: V = queue.popleft() print(V, end= ' ') for i in range(1, N+1): if visited_bfs[i] == 0 and graph[V][i] == 1: queue.append(i) visited_bfs[i] = 1..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/caeDPJ/btsDs2SG1lD/4nclvxB35vZ2HgWbxcG2nk/img.png)
๋ฐฑ์ค 2501๋ฒ ํ์ด : ์ฝ์ ๊ตฌํ๋ ํจ์๋ฅผ ๋จผ์ ๋ง๋ค๊ธฐ ์ ๊ณฑ๊ทผ์ ์ฝ์๊น์ง๋ง ๊ตฌํ๋ฉด ๋๋ ๋น ๋ฅธ ๋ฐฉ๋ฒ ์ด์ฉ ์ฝ๋: import sys input = sys.stdin.readline def yaksu(n): div = [] for i in range(1, int(n**(1/2))+1): if (n % i == 0): div.append(i) if ((i**2) != n): div.append(n//i) div.sort() return div n, k = map(int, input().rstrip().split()) div = yaksu(n) if (len(div) < k): print(0) else: print(div[k-1]) ** ์ฝ์ ๊ตฌํ๋ ๋ถ๋ถ ์๋ณด๊ธฐ
์ ๋ ฅ ์ฒซ์งธ ์ค์ N (1 ≤ N ≤ 100)๊ณผ M (1 ≤ M ≤ 100)์ด ์ฃผ์ด์ง๋ค. ๋์งธ ์ค๋ถํฐ M๊ฐ์ ์ค์ ๊ฑธ์ณ์ ๊ณต์ ๋ฃ๋ ๋ฐฉ๋ฒ์ด ์ฃผ์ด์ง๋ค. ๊ฐ ๋ฐฉ๋ฒ์ ์ธ ์ ์ i j k๋ก ์ด๋ฃจ์ด์ ธ ์์ผ๋ฉฐ, i๋ฒ ๋ฐ๊ตฌ๋๋ถํฐ j๋ฒ ๋ฐ๊ตฌ๋๊น์ง์ k๋ฒ ๋ฒํธ๊ฐ ์ ํ์ ธ ์๋ ๊ณต์ ๋ฃ๋๋ค๋ ๋ป์ด๋ค. ์๋ฅผ ๋ค์ด, 2 5 6์ 2๋ฒ ๋ฐ๊ตฌ๋๋ถํฐ 5๋ฒ ๋ฐ๊ตฌ๋๊น์ง์ 6๋ฒ ๊ณต์ ๋ฃ๋๋ค๋ ๋ป์ด๋ค. (1 ≤ i ≤ j ≤ N, 1 ≤ k ≤ N) ๋ํ์ด๋ ์ ๋ ฅ์ผ๋ก ์ฃผ์ด์ง ์์๋๋ก ๊ณต์ ๋ฃ๋๋ค. ์ถ๋ ฅ 1๋ฒ ๋ฐ๊ตฌ๋๋ถํฐ N๋ฒ ๋ฐ๊ตฌ๋์ ๋ค์ด์๋ ๊ณต์ ๋ฒํธ๋ฅผ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถํด ์ถ๋ ฅํ๋ค. ๊ณต์ด ๋ค์ด์์ง ์์ ๋ฐ๊ตฌ๋๋ 0์ ์ถ๋ ฅํ๋ค. ์ฝ๋ import sys input = sys.stdin.readline n, m = map(int, input().r..
์ ๋ ฅ ์ฒซ์งธ ์ค์ N (1 ≤ N ≤ 100)๊ณผ M (1 ≤ M ≤ 100)์ด ์ฃผ์ด์ง๋ค. ๋์งธ ์ค๋ถํฐ M๊ฐ์ ์ค์๋ ๋ฐ๊ตฌ๋์ ์์๋ฅผ ์ญ์์ผ๋ก ๋ง๋๋ ๋ฐฉ๋ฒ์ด ์ฃผ์ด์ง๋ค. ๋ฐฉ๋ฒ์ i j๋ก ๋ํ๋ด๊ณ , ์ผ์ชฝ์ผ๋ก๋ถํฐ i๋ฒ์งธ ๋ฐ๊ตฌ๋๋ถํฐ j๋ฒ์งธ ๋ฐ๊ตฌ๋์ ์์๋ฅผ ์ญ์์ผ๋ก ๋ง๋ ๋ค๋ ๋ป์ด๋ค. (1 ≤ i ≤ j ≤ N) ๋ํ์ด๋ ์ ๋ ฅ์ผ๋ก ์ฃผ์ด์ง ์์๋๋ก ๋ฐ๊ตฌ๋์ ์์๋ฅผ ๋ฐ๊พผ๋ค. ์ถ๋ ฅ ๋ชจ๋ ์์๋ฅผ ๋ฐ๊พผ ๋ค์์, ๊ฐ์ฅ ์ผ์ชฝ์ ์๋ ๋ฐ๊ตฌ๋๋ถํฐ ๋ฐ๊ตฌ๋์ ์ ํ์๋ ์์๋ฅผ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถํด ์ถ๋ ฅํ๋ค. ์ฝ๋ import sys input = sys.stdin.readline n, m = map(int, input().rstrip().split()) n_list = [] for i in range(1, n+1): n_list.append(i..
์ฝ๋ฆฐ์ด ํ๋ฌ๋์ ์ง์ง ์ด์ฌํํ์ - PS ๋ง์ด๋ ๊ฐค๋ฌ๋ฆฌ ํ์ด์ฌ (Python) ์์ฃผ ์ฌ์ฉ๋๋ ๋ฌธ์์ด ํจ์ (์ฝ๋ฉํ ์คํธ, ์๊ณ ๋ฆฌ์ฆ) [python] ์์ n์งธ ์๋ฆฌ๊น์ง ์ถ๋ ฅํ๊ธฐ (round(), %, format(), f-string) [python] ์์์ ๋ฐ์ฌ๋ฆผ, ์ฌ๋ฆผ, ๋ด๋ฆผํ๋ ์ฝ๋ Python - ๋ฆฌ์คํธ์ ์ฒซ๋ฒ์งธ ์์ ์ ๊ฑฐ Python - ๋ฌธ์์ด์ ํ ๊ธ์์ฉ ๋ถ๋ฆฌํ์ฌ ๋ฆฌ์คํธ์ ๋ฃ๊ธฐ [python] ๋ฆฌ์คํธ ๊ฐ์ ์ ๋ถ 0์ผ๋ก ์ด๊ธฐํ ํ๋ ๋ฒ(+ํน์ ๊ฐ์ผ๋ก ์ด๊ธฐํ) 150๋ฌธ์ ๋ก ์์ง ๊ฐ์ด ์ ์ ์ค์ค์ ์์ด์, ๋ฌธ์ ์๋ฅผ ๋๋ฆฌ์๋ฉด์ ์์ด๋์ด๋ ๋ฌธ์ ํด๊ฒฐ๋ฅ๋ ฅ์ KOI, USACO ๋ฌธ์ ์ ์ ํ์ด๋ณด์ธ์ - dc App2021.05.18 14:49:07 ใ ใ (118.235)๊ฐ์ฌํฉ๋๋ค ๊ณต๋ถํ๋ฉด์ koi ์ด๋ฑ๋ถ ๋ฌธ์ ์..
import sys from collections import deque input = sys.stdin.readline T = int(input().rstrip()) for i in range(T): k = int(input().rstrip()) n = int(input().rstrip()) people = [i for i in range(1, n+1)] # 0์ธต # 1์ธต 3ํธ 6๋ช 2์ธต์ 3ํธ 10๋ช for j in range(k): apt = [] for l in range(n): apt.append(sum(people[:l+1])) people = apt.copy() print(people) print(people[-1])
import sys from collections import deque input = sys.stdin.readline N, K = map(int, input().rstrip().split()) P = list(input().rstrip().split()) visited = set("".join(P)) q = deque([["".join(P),0]]) ans = -1 while(q): word, cnt = q.popleft() # ๋จ์ด, ๋จ์ด๋ฅผ ๋ฐ๊พผ ํ์ tmpP = list(word) if tmpP == sorted(tmpP): ans = cnt break isFrist = False for i in range(N-K+1): newP = list(tmpP) targetP = newP[i:i+K] ta..
์ฌ๋ฐฉ๋ฉด์ ๊ฐ์ ์๊น ์๋์ง ๊ฒ์ฌ DFS ๊ทธ๋ฅ DFS ‘R’์ ‘G’๋ก ๋ฐ๊พธ๊ณ DFS ํ๋ฒ ๋ import sys from collections import deque sys.setrecursionlimit(1000000) input = sys.stdin.readline def DFS(x, y): dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] visited[y][x] = 1 for i in range(4): nowx, nowy = x+dx[i], y+dy[i] if 0
- 2606 ์ ์ญ๋ณ์๋ฅผ ์ฌ์ฉํด์ cnt๊ฐ์ ์ฒดํฌํ๋๋ผ ์ ๋จน์๋๋ฐ ๊ตณ์ด ๊ทธ๋ด ํ์๊ฐ ์์๋ค ์ด์ฐจํผ ๋ฐฉ๋ฌธํ ๊ฐ์ visited์ ์ ์ฅํ๊ธฐ ๋๋ฌธ์ sum(visited) -1 ํด์ฃผ๋ฉด ๋๋ ๊ฒ! *์๊ฐ์ ์ ํ ์๊ฐ์ ๋ฐ์!! import sys from collections import deque input = sys.stdin.readline N = int(input().rstrip()) M = int(input().rstrip()) graph = [[0]*(N+1) for i in range(N+1)] visited = [0]*(N+1) for i in range(M): n1, n2 = map(int, input().rstrip().split()) graph[n1][n2] = graph[n2][n1] = 1..
True → 1, False → 0 ๋ก ๊ตฌํ import sys from collections import deque input = sys.stdin.readline # N : ์ ์ ๊ฐ์, M : ๊ฐ์ ๊ฐ์, V : ํ์์์์ N, M, V = map(int, input().rstrip().split()) # ์ธ์ ํ๋ ฌ์ ๋ชจ๋ 0์ผ๋ก ๊ตฌ์ฑ matrix = [[0]*(N+1) for i in range(N+1)] #๋ฐฉ๋ฌธํ ๊ณณ ์ฒดํฌ ๋ฆฌ์คํธ ์ ์ ๊ฐฏ์๋งํผ ํฌ๊ธฐ ๊ตฌ์ฑ visited_dfs = [0]*(N+1) visited_bfs = [0]*(N+1) # ๊ฐ์ ๊ฐฏ์ ๋งํผ ์ ๋ ฅ๋ฐ๊ธฐ, ์ ๋ ฅ๋ฐ๋ ๊ฐ์ ๋ํด ์ํ๋ ฌ์ 1 ์ฝ์ -> ์ธ์ ๋ฆฌ์คํธ ์์ฑ for i in range(M): n1, n2 = map(int, input(..
- Total
- Today
- Yesterday
- C์ธ์ด
- Aimers
- ํ์ด์ฌ์ฝํ
- ํ ํฌ์๋ฐ
- ๊ตฌ๊ธ์ฝ๋ฉ
- ํ๋ก๊ทธ๋๋จธ์ค
- ์ฝ๋ฉ์๋ฌ
- SKTECHSUMMIT
- dreambooth
- ๊ธฐ์ ์ปจํผ๋ฐ์ค
- CLOVAX
- MYSQL
- WGAN
- ๋ ผ๋ฌธ๋ฆฌ๋ทฐ
- ํ์ด์ฌ
- DALLE
- ๋๋ฆผ๋ถ์ค
- ๋ ผ๋ฌธ์ฝ๊ธฐ
- ์ฝํ
- ์ฝ๋ฉ๊ณต๋ถ
- AIRUSH2023
- gan
- AIRUSH
- ์คํ ์ด๋ธ๋ํจ์
- ์ฝํ ์ค๋น
- SQL
- HyperCLOVA
- StableDiffusion
- lgaimers
- AI์ปจํผ๋ฐ์ค
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 |