- 이 gist를 fork 하고 답안을 작성해서 제출해 주세요.
- 인터넷 검색, chat GPT 활용은 안 됩니다.
- IDE는 사용할 수 있습니다.
- 제출은 https://forms.gle/ER984HUpbHJYh7u39 폼을 이용해 주세요.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dfs(x, y): | |
# 기저 사례 | |
if x == 0 and y == 0: | |
return 1 | |
if dist[x][y] == -1: | |
dist[x][y] = 0 | |
for i in range(4): | |
nx, ny = x + dx[i], y + dy[i] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int cache[MAX][MAX]; | |
int solve(int w, int h) { | |
//기저 사례 | |
if (w == 0) return 1; | |
int& ret = cache[w][h]; | |
if (ret != -1) return ret; | |
ret = 0; | |
if (w > 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define endl "\n" | |
using namespace std; | |
int res = 0; | |
vector <int> weight; | |
bool compare(int x, int y) { return x > y; } | |
int main() { | |
ios::sync_with_stdio(false); | |
cout.tie(0); cin.tie(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
n = int(sys.stdin.readline()) | |
dp = [0, 1, 2] | |
for i in range(3, n+1): | |
dp.append((dp[i-1] + dp[i-2]) % 10007) | |
print(dp[n]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define endl "\n" | |
using namespace std; | |
int cache[1001]; | |
int solve(int n) { | |
if (n == 1) return 1; | |
if (n == 2) return 2; | |
int& ret = cache[n]; | |
if (ret != -1) return ret; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for t in range(n): | |
for i in range(n): | |
for j in range(i, n): | |
if i != j: #최소 비용 계산 | |
temp = min(graph[i][j], graph[i][t] + graph[t][j]) | |
graph[i][j] = graph[j][i] = temp | |
answer = INF | |
for t in range(n): #경유점에 따라 최소 합승 비용 탐색 | |
temp = graph[s - 1][t] + graph[t][b - 1] + graph[t][a - 1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
input = sys.stdin.readline | |
n = int(input()) | |
num = list(map(int, input().split())) | |
length = [0] * n | |
for i in range(n): | |
for j in range(i): | |
if num[j] > num[i] and length[j] > length[i]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
from copy import deepcopy | |
import sys | |
input = sys.stdin.readline | |
t = int(input()) | |
for _ in range(t): | |
n, k = map(int, input().split()) | |
time = [0] |