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

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver2] 3085๋ฒˆ_์‚ฌํƒ• ๊ฒŒ์ž„

๋ฌธ์ œ https://www.acmicpc.net/problem/3085 3085๋ฒˆ: ์‚ฌํƒ• ๊ฒŒ์ž„ ์˜ˆ์ œ 3์˜ ๊ฒฝ์šฐ 4๋ฒˆ ํ–‰์˜ Y์™€ C๋ฅผ ๋ฐ”๊พธ๋ฉด ์‚ฌํƒ• ๋„ค ๊ฐœ๋ฅผ ๋จน์„ ์ˆ˜ ์žˆ๋‹ค. www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 3085๋ฒˆ ๋ฌธ์ œ - ์‚ฌํƒ• ๊ฒŒ์ž„ n = int(input()) candy =[list(input()) for _ in range(n)] dx = [0,0,1,-1] dy = [1,-1,0,0] result = 0 temp = '' for i in range(n): for j in range(n): for k in range(4): nx = dx[k] + j ny = dy[k] + i if nx>=0 and ny>=0 and nx

๐Ÿšฉ 2023 / 05 TIL[Today I Learned] ํšŒ๊ณ 

๐Ÿ“Œ 2023 - 05 ๋ฒŒ์จ 5์›”์ด ๋‹ค ์ง€๋‚˜๊ฐ”๋‹ค. 1์ผ 1ํฌ์ŠคํŒ…์„ ํ•˜๋ ค๊ณ  ํ–ˆ์ง€๋งŒ ์‡ผํ•‘๋ชฐ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋‹ค๋ณด๋‹ˆ ๋ธ”๋กœ๊ทธ ๊ธ€ ์ž‘์„ฑ์„ ํ•  ์‹œ๊ฐ„์ด ์—†์—ˆ๋‹ค.. ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋„ ์š”์ฆ˜ ํ’€์ง€ ๋ชปํ•ด์„œ ๊ฐ์„ ์žƒ์€ ๊ฒƒ ๊ฐ™์€๋ฐ ๋‹ค์‹œ ์‹œ์ž‘ํ•ด์•ผ๋œ๋‹ค.. 5์›” ๋ง์— ๊ตญ๋ฏผ์€ํ–‰ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ๋ฅผ ๋ดค๋Š”๋ฐ ๊ธฐ์–ต์„ ์‚ด๋ ค์„œ ์ •๋ฆฌํ•ด๋ณด๋ ค๊ณ  ํ•œ๋‹ค. 1. ๊ตญ๋ฏผ์€ํ–‰ ์ฝ”๋”ฉํ…Œ์ŠคํŠธ https://kbstar.incruit.com/hire/hirelist.asp KB๊ตญ๋ฏผ์€ํ–‰ ์ฑ„์šฉ์ •๋ณด kbstar.incruit.com ์‹œํ—˜ ๋‚ด์šฉ์„ ๋ชจ๋‘ ๊ธฐ์–ตํ•˜์ง€๋„ ๋ชปํ•˜๊ณ  ์œ ์ถœ์„ ํ•˜๋ฉด ์•ˆ๋ผ์„œ ๋Œ€๋žต์ ์ธ ๋ถ€๋ถ„๋“ค๋งŒ ์ž‘์„ฑํ–ˆ๋‹ค. ์‹œํ—˜์€ ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์—์„œ ์ง„ํ–‰๋˜์—ˆ๋‹ค. 10์‹œ 30๋ถ„๋ถ€ํ„ฐ 1์‹œ ์˜€๋˜ ๊ฒƒ ๊ฐ™์€๋ฐ ์ž˜ ๊ธฐ์–ต๋‚˜์ง€ ์•Š๋Š”๋‹ค. ์ž…์‹ค์€ 30๋ถ„ ์ „๊นŒ์ง€ ํ•˜๊ณ  ๋ชจ๋‘ ์„ค์ •์„ ๋งˆ์ณ์•ผ ํ–ˆ๊ณ  ์ด 4๋ฌธ์ œ๊ฐ€ ๋‚˜์™”๋‹ค. ๋งˆ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver3] 15903๋ฒˆ_์นด๋“œ ํ•ฉ์ฒด ๋†€์ด

๋ฌธ์ œ https://www.acmicpc.net/problem/15903 15903๋ฒˆ: ์นด๋“œ ํ•ฉ์ฒด ๋†€์ด ์ฒซ ๋ฒˆ์งธ ์ค„์— ์นด๋“œ์˜ ๊ฐœ์ˆ˜๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆ˜ n(2 ≤ n ≤ 1,000)๊ณผ ์นด๋“œ ํ•ฉ์ฒด๋ฅผ ๋ช‡ ๋ฒˆ ํ•˜๋Š”์ง€๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ์ˆ˜ m(0 ≤ m ≤ 15×n)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘ ๋ฒˆ์งธ ์ค„์— ๋งจ ์ฒ˜์Œ ์นด๋“œ์˜ ์ƒํƒœ๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” n๊ฐœ์˜ ์ž์—ฐ์ˆ˜ a1, www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 15903๋ฒˆ ๋ฌธ์ œ - ์นด๋“œ ํ•ฉ์ฒด ๋†€์ด import sys import heapq input = sys.stdin.readline n, m = map(int, input().split()) cards = list(map(int, input().split())) heapq.heapify(cards) for i in range(m): value ..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Silver3] 2346๋ฒˆ_ํ’์„  ํ„ฐ๋œจ๋ฆฌ๊ธฐ

๋ฌธ์ œ https://www.acmicpc.net/problem/2346 2346๋ฒˆ: ํ’์„  ํ„ฐ๋œจ๋ฆฌ๊ธฐ 1๋ฒˆ๋ถ€ํ„ฐ N๋ฒˆ๊นŒ์ง€ N๊ฐœ์˜ ํ’์„ ์ด ์›ํ˜•์œผ๋กœ ๋†“์—ฌ ์žˆ๊ณ . i๋ฒˆ ํ’์„ ์˜ ์˜ค๋ฅธ์ชฝ์—๋Š” i+1๋ฒˆ ํ’์„ ์ด ์žˆ๊ณ , ์™ผ์ชฝ์—๋Š” i-1๋ฒˆ ํ’์„ ์ด ์žˆ๋‹ค. ๋‹จ, 1๋ฒˆ ํ’์„ ์˜ ์™ผ์ชฝ์— N๋ฒˆ ํ’์„ ์ด ์žˆ๊ณ , N๋ฒˆ ํ’์„ ์˜ ์˜ค๋ฅธ์ชฝ์— 1๋ฒˆ ํ’์„  www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 2346๋ฒˆ ๋ฌธ์ œ - ํ’์„  ํ„ฐ๋œจ๋ฆฌ๊ธฐ import sys from collections import deque input = sys.stdin.readline n = int(input()) q = deque(enumerate(map(int, input().split()))) answer = [] while q: idx, paper = q.popleft() answ..

๊นƒํ—ˆ๋ธŒ ์›๊ฒฉ ๋ธŒ๋žœ์น˜์™€ ๋กœ์ปฌ ๋ธŒ๋žœ์น˜ ๋™๊ธฐํ™”

- ์›๊ฒฉ ๋ธŒ๋žœ์น˜ ๋กœ์ปฌ ๋ธŒ๋žœ์น˜ ๋™๊ธฐํ™” - ์‡ผํ•‘๋ชฐ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰์ค‘ PR ํ›„์— ๋ธŒ๋žœ์น˜๋ฅผ ์‚ญ์ œํ•˜์˜€๋Š”๋ฐ git branch -a ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์˜€๋”๋‹ˆ ์›๊ฒฉ ์ €์žฅ์†Œ์— ๋ชจ๋“  ๋ธŒ๋žœ์น˜๊ฐ€ ์‚ด์•„ ์žˆ์—ˆ๋‹ค. ์ฐพ์•„๋ณธ ๊ฒฐ๊ณผ ๊นƒํ—ˆ๋ธŒ์—์„œ Delete๋กœ ์‚ญ์ œํ•˜๊ฒŒ ๋˜๋ฉด ๊ฐ€๋” ๋กœ์ปฌ์—์„œ ๋ฐ˜์˜์ด ์•ˆ๋œ๋‹ค๊ณ  ํ•œ๋‹ค. ๊ทธ๋ž˜์„œ ์ง€์šฐ๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ์•„์™”๋‹ค. git fetch --all --prune ์ด ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์›๊ฒฉ๊ณผ ๋กœ์ปฌ์˜ ๋ธŒ๋žœ์น˜๊ฐ€ ๋™๊ธฐํ™” ๋œ๋‹ค. ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•  ๋•Œ ๋˜ ์‚ฌ์šฉํ•  ๊ฒƒ ๊ฐ™์•„ ๊ธฐ์–ตํ•ด์•ผ๊ฒ ๋‹ค.

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 1339๋ฒˆ_๋‹จ์–ด ์ˆ˜ํ•™

๋ฌธ์ œ https://www.acmicpc.net/problem/1339 1339๋ฒˆ: ๋‹จ์–ด ์ˆ˜ํ•™ ์ฒซ์งธ ์ค„์— ๋‹จ์–ด์˜ ๊ฐœ์ˆ˜ N(1 ≤ N ≤ 10)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„๋ถ€ํ„ฐ N๊ฐœ์˜ ์ค„์— ๋‹จ์–ด๊ฐ€ ํ•œ ์ค„์— ํ•˜๋‚˜์”ฉ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ์–ด๋Š” ์•ŒํŒŒ๋ฒณ ๋Œ€๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ์žˆ๋‹ค. ๋ชจ๋“  ๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” ์•ŒํŒŒ๋ฒณ์€ ์ตœ๋Œ€ www.acmicpc.net ํ’€์ด n = int(input()) words = [] for _ in range(n): words.append(list(map(lambda x: ord(x) - 65, input()))) # ์•ŒํŒŒ๋ฒณ์„ ์ˆซ์ž๋กœ ๋ฐ”๊พธ์–ด ์ธ๋ฑ์Šค๋กœ ์“ธ ์ˆ˜ ์žˆ๋„๋ก ํ•จ alphabets = [0] * 26 # ๊ฐ ์•ŒํŒŒ๋ฒณ์˜ ์ž๋ฆฟ์ˆ˜ ์ €์žฅ for word in words: for idx, char in enumerat..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold5] 13219๋ฒˆ_Trains

๋ฌธ์ œ https://www.acmicpc.net/short/status/13219/1 13219๋ฒˆ ์ˆ์ฝ”๋”ฉ - 1 ํŽ˜์ด์ง€ ๋ชจ๋“  ์–ธ์–ดC++JavaPythonCRustC++17Java 8Python 3C11PyPy3C99C++98C++11C++14Java 8 (OpenJDK)Java 11C++20RubyKotlin (JVM)SwiftTextC#node.jsGoGo (gccgo)Java 15DD (LDC)PHPRust 2015Rust 2018Rust 2021PascalScalaLuaPerlF#Visual BasicObjective-CObjective-C++C99 ( www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 13219๋ฒˆ ๋ฌธ์ œ - trains from heapq import heappush, heappop imp..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold2] 12015๋ฒˆ_๊ฐ€์žฅ ๊ธด ์ฆ๊ฐ€ํ•˜๋Š” ๋ถ€๋ถ„ ์ˆ˜์—ด 2

๋ฌธ์ œ https://www.acmicpc.net/problem/12015 12015๋ฒˆ: ๊ฐ€์žฅ ๊ธด ์ฆ๊ฐ€ํ•˜๋Š” ๋ถ€๋ถ„ ์ˆ˜์—ด 2 ์ฒซ์งธ ์ค„์— ์ˆ˜์—ด A์˜ ํฌ๊ธฐ N (1 ≤ N ≤ 1,000,000)์ด ์ฃผ์–ด์ง„๋‹ค. ๋‘˜์งธ ์ค„์—๋Š” ์ˆ˜์—ด A๋ฅผ ์ด๋ฃจ๊ณ  ์žˆ๋Š” Ai๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. (1 ≤ Ai ≤ 1,000,000) www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 12015๋ฒˆ ๋ฌธ์ œ - ๊ฐ€์žฅ ๊ธด ์ฆ๊ฐ€ํ•˜๋Š” ๋ถ€๋ถ„ ์ˆ˜์—ด n = int(input()) arr = list(map(int, input().split())) stack = [0] def binary_search(target, start, end): while start

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold4] 1043๋ฒˆ_๊ฑฐ์ง“๋ง

๋ฌธ์ œ https://www.acmicpc.net/problem/1043 1043๋ฒˆ: ๊ฑฐ์ง“๋ง ์ง€๋ฏผ์ด๋Š” ํŒŒํ‹ฐ์— ๊ฐ€์„œ ์ด์•ผ๊ธฐ ํ•˜๋Š” ๊ฒƒ์„ ์ข‹์•„ํ•œ๋‹ค. ํŒŒํ‹ฐ์— ๊ฐˆ ๋•Œ๋งˆ๋‹ค, ์ง€๋ฏผ์ด๋Š” ์ง€๋ฏผ์ด๊ฐ€ ๊ฐ€์žฅ ์ข‹์•„ํ•˜๋Š” ์ด์•ผ๊ธฐ๋ฅผ ํ•œ๋‹ค. ์ง€๋ฏผ์ด๋Š” ๊ทธ ์ด์•ผ๊ธฐ๋ฅผ ๋งํ•  ๋•Œ, ์žˆ๋Š” ๊ทธ๋Œ€๋กœ ์ง„์‹ค๋กœ ๋งํ•˜๊ฑฐ๋‚˜ ์—„์ฒญ๋‚˜๊ฒŒ www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 1043๋ฒˆ ๋ฌธ์ œ - ๊ฑฐ์ง“๋ง import sys n, m = list(map(int, sys.stdin.readline().split())) truth = list(map(int, sys.stdin.readline().split()))[1:] KNOW_TRUTH = 0 parent = [i for i in range(n + 1)] for person in truth: parent[perso..

๐ŸŸฉ [๋ฐฑ์ค€] [Python] [Gold5] 13023๋ฒˆ_ABCDE

๋ฌธ์ œ https://www.acmicpc.net/problem/13023 13023๋ฒˆ: ABCDE ๋ฌธ์ œ์˜ ์กฐ๊ฑด์— ๋งž๋Š” A, B, C, D, E๊ฐ€ ์กด์žฌํ•˜๋ฉด 1์„ ์—†์œผ๋ฉด 0์„ ์ถœ๋ ฅํ•œ๋‹ค. www.acmicpc.net ํ’€์ด # ๋ฐฑ์ค€ 13023๋ฒˆ ๋ฌธ์ œ - ABCDE # dfs import sys input = sys.stdin.readline sys.setrecursionlimit(100000) n, m = map(int , input().split()) visited = [0]*(n) graph = [ [] for _ in range(n) ] answer = 0 for _ in range(m): a,b = map(int, input().split()) graph[a].append(b) graph[b].appen..