๋ถ„๋ฅ˜ ์ „์ฒด๋ณด๊ธฐ 479

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] [์‚ผ์„ฑ SW ์—ญ๋Ÿ‰ ํ…Œ์ŠคํŠธ ๊ธฐ์ถœ ๋ฌธ์ œ] 17144๋ฒˆ_๋ฏธ์„ธ๋จผ์ง€ ์•ˆ๋…•!

๋ฌธ์ œ https://www.acmicpc.net/problem/17144 17144๋ฒˆ: ๋ฏธ์„ธ๋จผ์ง€ ์•ˆ๋…•! ๋ฏธ์„ธ๋จผ์ง€๋ฅผ ์ œ๊ฑฐํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌ์‚ฌ๊ณผ๋Š” ๊ณต๊ธฐ์ฒญ์ •๊ธฐ๋ฅผ ์„ค์น˜ํ•˜๋ ค๊ณ  ํ•œ๋‹ค. ๊ณต๊ธฐ์ฒญ์ •๊ธฐ์˜ ์„ฑ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•˜๊ธฐ ์œ„ํ•ด ๊ตฌ์‚ฌ๊ณผ๋Š” ์ง‘์„ ํฌ๊ธฐ๊ฐ€ R×C์ธ ๊ฒฉ์žํŒ์œผ๋กœ ๋‚˜ํƒ€๋ƒˆ๊ณ , 1×1 ํฌ๊ธฐ์˜ ์นธ์œผ๋กœ ๋‚˜๋ˆด๋‹ค. ๊ตฌ์‚ฌ www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 17144๋ฒˆ ๋ฌธ์ œ - ๋ฏธ์„ธ๋จผ์ง€ ์•ˆ๋…•! from copy import deepcopy r, c, t = map(int, input().split()) graph = [] for _ in range(r): graph.append(list(map(int, input().split()))) dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1] def spread(): ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] [์‚ผ์„ฑ SW ์—ญ๋Ÿ‰ ํ…Œ์ŠคํŠธ ๊ธฐ์ถœ ๋ฌธ์ œ] 14499๋ฒˆ_์ฃผ์‚ฌ์œ„ ๊ตด๋ฆฌ๊ธฐ

๋ฌธ์ œ https://www.acmicpc.net/problem/14499 14499๋ฒˆ: ์ฃผ์‚ฌ์œ„ ๊ตด๋ฆฌ๊ธฐ ์ฒซ์งธ ์ค„์— ์ง€๋„์˜ ์„ธ๋กœ ํฌ๊ธฐ N, ๊ฐ€๋กœ ํฌ๊ธฐ M (1 ≤ N, M ≤ 20), ์ฃผ์‚ฌ์œ„๋ฅผ ๋†“์€ ๊ณณ์˜ ์ขŒํ‘œ x, y(0 ≤ x ≤ N-1, 0 ≤ y ≤ M-1), ๊ทธ๋ฆฌ๊ณ  ๋ช…๋ น์˜ ๊ฐœ์ˆ˜ K (1 ≤ K ≤ 1,000)๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์— ์ง€ www.acmicpc.net ํ’€์ด import sys input = sys.stdin.readline N, M, X, Y, K = map(int,input().rstrip().split()) dx = [0,0,-1,1] dy = [1,-1,0,0] # 1 ๋™, 2 ์„œ, 3 ๋ถ, 4 ๋‚จ dice = [0,0,0,0,0,0] # down left front ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 3190๋ฒˆ_๋ฑ€

๋ฌธ์ œ https://www.acmicpc.net/problem/3190 3190๋ฒˆ: ๋ฑ€ 'Dummy' ๋ผ๋Š” ๋„์Šค๊ฒŒ์ž„์ด ์žˆ๋‹ค. ์ด ๊ฒŒ์ž„์—๋Š” ๋ฑ€์ด ๋‚˜์™€์„œ ๊ธฐ์–ด๋‹ค๋‹ˆ๋Š”๋ฐ, ์‚ฌ๊ณผ๋ฅผ ๋จน์œผ๋ฉด ๋ฑ€ ๊ธธ์ด๊ฐ€ ๋Š˜์–ด๋‚œ๋‹ค. ๋ฑ€์ด ์ด๋ฆฌ์ €๋ฆฌ ๊ธฐ์–ด๋‹ค๋‹ˆ๋‹ค๊ฐ€ ๋ฒฝ ๋˜๋Š” ์ž๊ธฐ์ž์‹ ์˜ ๋ชธ๊ณผ ๋ถ€๋”ชํžˆ๋ฉด ๊ฒŒ์ž„์ด ๋๋‚œ๋‹ค. ๊ฒŒ์ž„ www.acmicpc.net ํ’€์ด from collections import deque n = int(input()) k = int(input()) graph = [[0]*n for _ in range(n)] for _ in range(k): a, b = map(int, input().split()) graph[a-1][b-1] = 1 l = int(input()) turn = [] for _ in range(l): t, d ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 2110๋ฒˆ_๊ณต์œ ๊ธฐ ์„ค์น˜

๋ฌธ์ œ https://www.acmicpc.net/problem/2110 2110๋ฒˆ: ๊ณต์œ ๊ธฐ ์„ค์น˜ ์ฒซ์งธ ์ค„์— ์ง‘์˜ ๊ฐœ์ˆ˜ N (2 ≤ N ≤ 200,000)๊ณผ ๊ณต์œ ๊ธฐ์˜ ๊ฐœ์ˆ˜ C (2 ≤ C ≤ N)์ด ํ•˜๋‚˜ ์ด์ƒ์˜ ๋นˆ ์นธ์„ ์‚ฌ์ด์— ๋‘๊ณ  ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์—๋Š” ์ง‘์˜ ์ขŒํ‘œ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” xi (0 ≤ xi ≤ 1,000,000,000)๊ฐ€ www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 2110๋ฒˆ ๋ฌธ์ œ - ๊ณต์œ ๊ธฐ ์„ค์น˜ import sys input = sys.stdin.readline n, c = map(int, input().split()) x = [] for i in range(n): x.append(int(input())) x.sort() def binary_search(x, start, end): wh..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold3] 16236๋ฒˆ_์•„๊ธฐ ์ƒ์–ด

๋ฌธ์ œ https://www.acmicpc.net/problem/16236 16236๋ฒˆ: ์•„๊ธฐ ์ƒ์–ด N×N ํฌ๊ธฐ์˜ ๊ณต๊ฐ„์— ๋ฌผ๊ณ ๊ธฐ M๋งˆ๋ฆฌ์™€ ์•„๊ธฐ ์ƒ์–ด 1๋งˆ๋ฆฌ๊ฐ€ ์žˆ๋‹ค. ๊ณต๊ฐ„์€ 1×1 ํฌ๊ธฐ์˜ ์ •์‚ฌ๊ฐํ˜• ์นธ์œผ๋กœ ๋‚˜๋ˆ„์–ด์ ธ ์žˆ๋‹ค. ํ•œ ์นธ์—๋Š” ๋ฌผ๊ณ ๊ธฐ๊ฐ€ ์ตœ๋Œ€ 1๋งˆ๋ฆฌ ์กด์žฌํ•œ๋‹ค. ์•„๊ธฐ ์ƒ์–ด์™€ ๋ฌผ๊ณ ๊ธฐ๋Š” ๋ชจ๋‘ ํฌ๊ธฐ๋ฅผ ๊ฐ€ www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 16236๋ฒˆ ๋ฌธ์ œ - ์•„๊ธฐ ์ƒ์–ด from collections import deque dx, dy = [0,0,-1,1],[1,-1,0,0] n = int(input()) graph = [list(map(int, input().split())) for _ in range(n)] x, y, shark_size = 0,0,2 for i in range(n): for j in..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold2] 1300๋ฒˆ_K๋ฒˆ์งธ ์ˆ˜

๋ฌธ์ œ https://www.acmicpc.net/problem/1300 1300๋ฒˆ: K๋ฒˆ์งธ ์ˆ˜ ์„ธ์ค€์ด๋Š” ํฌ๊ธฐ๊ฐ€ N×N์ธ ๋ฐฐ์—ด A๋ฅผ ๋งŒ๋“ค์—ˆ๋‹ค. ๋ฐฐ์—ด์— ๋“ค์–ด์žˆ๋Š” ์ˆ˜ A[i][j] = i×j ์ด๋‹ค. ์ด ์ˆ˜๋ฅผ ์ผ์ฐจ์› ๋ฐฐ์—ด B์— ๋„ฃ์œผ๋ฉด B์˜ ํฌ๊ธฐ๋Š” N×N์ด ๋œ๋‹ค. B๋ฅผ ์˜ค๋ฆ„์ฐจ์ˆœ ์ •๋ ฌํ–ˆ์„ ๋•Œ, B[k]๋ฅผ ๊ตฌํ•ด๋ณด์ž. ๋ฐฐ์—ด A์™€ B www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 1300๋ฒˆ ๋ฌธ์ œ - K๋ฒˆ์งธ ์ˆ˜ n, k = int(input()), int(input()) start, end = 1, k while start = k: answer = mid end = mid - 1 else: start = mid + 1 print(answer)

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 10830๋ฒˆ_ํ–‰๋ ฌ ์ œ๊ณฑ

๋ฌธ์ œ https://www.acmicpc.net/problem/10830 10830๋ฒˆ: ํ–‰๋ ฌ ์ œ๊ณฑ ํฌ๊ธฐ๊ฐ€ N*N์ธ ํ–‰๋ ฌ A๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์ด๋•Œ, A์˜ B์ œ๊ณฑ์„ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ˆ˜๊ฐ€ ๋งค์šฐ ์ปค์งˆ ์ˆ˜ ์žˆ์œผ๋‹ˆ, A^B์˜ ๊ฐ ์›์†Œ๋ฅผ 1,000์œผ๋กœ ๋‚˜๋ˆˆ ๋‚˜๋จธ์ง€๋ฅผ ์ถœ๋ ฅํ•œ๋‹ค. www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 10830๋ฒˆ ๋ฌธ์ œ - ํ–‰๋ ฌ ์ œ๊ณฑ import sys input = sys.stdin.readline # ์ž…๋ ฅ N, B = map(int, input().split()) matrix = [] for _ in range(N): matrix.append(list(map(int, input().split()))) # ํ–‰๋ ฌ ๊ณฑ์…ˆ def mul_matrix(mat1, mat2): res = [[0]*N..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver4] 2960๋ฒˆ_์—๋ผํ† ์Šคํ…Œ๋„ค์Šค์˜ ์ฒด

๋ฌธ์ œ https://www.acmicpc.net/problem/2960 2960๋ฒˆ: ์—๋ผํ† ์Šคํ…Œ๋„ค์Šค์˜ ์ฒด 2, 4, 6, 8, 10, 3, 9, 5, 7 ์ˆœ์„œ๋Œ€๋กœ ์ง€์›Œ์ง„๋‹ค. 7๋ฒˆ์งธ ์ง€์›Œ์ง„ ์ˆ˜๋Š” 9์ด๋‹ค. www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 2960๋ฒˆ ๋ฌธ์ œ - ์—๋ผํ† ์Šคํ…Œ๋„ค์Šค์˜ ์ฒด N, K = map(int, input().split()) tmp = 0 sieve = [True] * (N + 1) for i in range(2, N + 1): for j in range(i, N + 1, i): if sieve[j] != False: sieve[j] = False tmp += 1 if tmp == K: print(j)

โฌ› [Programmers] [BFS/DFS] [Python] Level2_H-Index

๋ฌธ์ œ https://school.programmers.co.kr/learn/courses/30/lessons/42747 ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”. programmers.co.kr ํ’€์ด # ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค 2๋‹จ๊ณ„ - H-Index def solution(citations): citations.sort() length = len(citations) for i in range(length): if citations[i] >= length-i: return length-i return 0 print(solution([3,0,6,1,5]))

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver1] [์‚ผ์„ฑ SW ์—ญ๋Ÿ‰ ํ…Œ์ŠคํŠธ ๊ธฐ์ถœ ๋ฌธ์ œ] 14891๋ฒˆ_ํ†ฑ๋‹ˆ๋ฐ”ํ€ด

๋ฌธ์ œ https://www.acmicpc.net/problem/14891 14891๋ฒˆ: ํ†ฑ๋‹ˆ๋ฐ”ํ€ด ์ด 8๊ฐœ์˜ ํ†ฑ๋‹ˆ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ํ†ฑ๋‹ˆ๋ฐ”ํ€ด 4๊ฐœ๊ฐ€ ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด ์ผ๋ ฌ๋กœ ๋†“์—ฌ์ ธ ์žˆ๋‹ค. ๋˜, ํ†ฑ๋‹ˆ๋Š” N๊ทน ๋˜๋Š” S๊ทน ์ค‘ ํ•˜๋‚˜๋ฅผ ๋‚˜ํƒ€๋‚ด๊ณ  ์žˆ๋‹ค. ํ†ฑ๋‹ˆ๋ฐ”ํ€ด์—๋Š” ๋ฒˆํ˜ธ๊ฐ€ ๋งค๊ฒจ์ ธ ์žˆ๋Š”๋ฐ, ๊ฐ€์žฅ ์™ผ์ชฝ ํ†ฑ๋‹ˆ๋ฐ”ํ€ด www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 14891๋ฒˆ ๋ฌธ์ œ - ํ†ฑ๋‹ˆ๋ฐ”๊ท€ import sys input = sys.stdin.readline graph = [] for _ in range(4): graph.append(list(input().rstrip())) k = int(input()) data = [] def rotate_clock(graph): temp = graph[7] for i in range(6, -1..