๋ฐฑ์ค€

๐ŸฅˆSilver 5 https://www.acmicpc.net/problem/10815  โœ… 1์ฐจ ํ’€์ดimport sysinput=sys.stdin.readlineanswer=''n=int(input())having_cards=set(map(int,input().rstrip().split()))m=int(input())num_list=list(map(int,input().rstrip().split()))for num in num_list: if num in having_cards: answer+='1' else: answer+='0'print(' '.join(answer))input์˜ ๋ฒ”์œ„๊ฐ€ 10^7์œผ๋กœ ์ด๋ถ„ํƒ์ƒ‰์„ ํ•ด์•ผํ•˜๋‚˜ ํ–ˆ์ง€๋งŒ, ์ผ๋‹จ ํ•œ๋ฒˆ ์ •์งํ•˜๊ฒŒ ํ’€์–ด๋ณด์•˜๋‹ค.์ƒ๊ทผ์ด..
๐Ÿฅ‡ Gold4 https://www.acmicpc.net/problem/10282     โœ… ์ •๋‹ต ํ’€์ดfrom sys import stdinfrom heapq import heappop,heappushinput = stdin.readlinet=int(input())INF=float('inf')def dijkstra(start): dist=[INF]*len(graph) dist[start]=0 q=[(0,start)] while q: cost,idx=heappop(q) if dist[idx] โœจ ๊ฒฝ๋กœ๋Š” ์–‘๋ฐฉํ–ฅ์ด ์•„๋‹ˆ์ง€๋งŒ ๊ฐ์—ผ์€ ์—ญ๋ฐฉํ–ฅ์œผ๋กœ ํผ์ ธ๋‚˜๊ฐ€๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ๋ž˜ํ”„์— ๊ฐ’์„ ๋„ฃ์–ด์ค„๋•Œ ์—ญ๋ฐฉํ–ฅ์œผ๋กœ ๋„ฃ์–ด์ฃผ๋ฉด ๋œ๋‹ค.๊ทธ๋ ‡๊ฒŒ๋˜๋ฉด, ๊ฐ์—ผ๋œ ์ปดํ“จํ„ฐ์˜ ๊ฐœ์ˆ˜๋„ ๋‹ค์ต์ŠคํŠธ๋ผ ๊ฒฐ๊ณผ๊ฐ’์œผ๋กœ..
๐Ÿฅ‡ Gold4https://www.acmicpc.net/problem/1753   โœ… ์ •๋‹ตํ’€์ดimport sysfrom heapq import *input=sys.stdin.readlineINF=float('inf')def dijkstra(start): dist=[INF]*len(graph) dist[start]=0 #์‹œ์ž‘์  ๊ฑฐ๋ฆฌ๋Š” 0 q=[(0,start)] #(cost,๋…ธ๋“œ๋ฒˆํ˜ธ) while q: cost,idx=heappop(q) if dist[idx] ์šฐ์„ ์ˆœ์œ„ ํ๋ฅผ ์ด์šฉํ•œ ๋‹ค์ต์ŠคํŠธ๋ผ ์ตœ๋‹จ ๊ฒฝ๋กœ ์•Œ๊ณ ๋ฆฌ์ฆ˜  โ—๏ธ์ „์ฒด ๋…ธ๋“œ์˜ ๊ฐœ์ˆ˜๊ฐ€ 10,000๊ฐœ ์ด์ƒ์ด๋ผ๋ฉด, ๋ฆฌ์ŠคํŠธ๊ฐ€ ์•„๋‹Œ ์šฐ์„ ์ˆœ์œ„ ํ(ํž™)์„ ์‚ฌ์šฉํ•ด ๋ฌธ์ œ๋ฅผ ํ’€์–ด์•ผํ•œ๋‹ค.   ๐Ÿ‘‰๐Ÿป ๋‹ค์ต์ŠคํŠธ๋ผ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‹œ๊ฐ„ ..
๐Ÿฅˆ Silver3https://www.acmicpc.net/problem/8911       โœ… ์ •๋‹ตํ’€์ดimport sysinput = sys.stdin.readlinen = int(input()) dx = [0, 1, 0, -1]dy = [1, 0, -1, 0]for _ in range(n): commands = input().strip() direction = 0 # ์ดˆ๊ธฐ๋ฐฉํ–ฅ=๋ถ์ชฝ (0: ๋ถ, 1: ๋™, 2: ๋‚จ, 3: ์„œ) x, y = 0, 0 # ์ดˆ๊ธฐ์œ„์น˜ min_x, min_y = 0, 0 max_x, max_y = 0, 0 for command in commands: if command == 'F': x += dx[di..
๐Ÿฅˆ Silver2 https://www.acmicpc.net/problem/17086   โœ… ์ •๋‹ตํ’€์ดimport sysfrom collections import dequeinput = sys.stdin.readlinem, n = map(int, input().rstrip().split())dx = [0, 1, 1, 1, 0, -1, -1, -1]dy = [-1, -1, 0, 1, 1, 1, 0, -1]def bfs(): result = 0 while queue: cy, cx = queue.popleft() for i in range(8): ny, nx = dy[i] + cy, dx[i] + cx # ์ƒ์–ด๊ฐ€ ์—†๋Š” 0์— ๋Œ€ํ•ด ์ด๋™ ..
๐Ÿฅˆ Silver3 https://www.acmicpc.net/problem/1063   โœ… ์ •๋‹ต ํ’€์ดimport sysinput = sys.stdin.readlineking, stone, n = input().rstrip().split()# ์ด๋™ ๋ฐฉํ–ฅ (row,col)move = { 'R': (0, 1), 'L': (0, -1), 'B': (1, 0), 'T': (-1, 0), 'RT': (-1, 1), 'RB': (1, 1), 'LT': (-1, -1), 'LB': (1, -1)}cols = {'A': 0, 'B': 1, 'C': 2, 'D': 3, 'E': 4, 'F': 5, 'G': 6, 'H': 7} #{0:'A'}reversed_cols = {v: k for k, v in cols...
๐Ÿฅˆ Silver5https://www.acmicpc.net/problem/1251  import sysfrom itertools import combinationsinput = sys.stdin.readlineword = list(input().strip())word_length = len(word)result = set()for i in range(1, word_length - 1): for j in range(i+1, word_length): first = word[:i] sec = word[i:j] thrid = word[j:] # reverse first.reverse() sec.reverse() thr..
๐Ÿฅ‰ Bronze3https://www.acmicpc.net/problem/2061 โŽ 1์ฐจ ํ’€์ดimport mathimport sysfrom itertools import permutations# ๋‘ ์†Œ์ˆ˜ ๊ตฌํ•˜๊ธฐ# ๋‘ ์†Œ์ˆ˜๊ฐ€ l ์ด์ƒ์ธ์ง€ ํ™•์ธ# O - good# X - ๋” ์ž‘์€ ์†Œ์ˆ˜ ์ถœ๋ ฅinput = sys.stdin.readlinek, l = map(int, input().rstrip().split())for divisor in range(l,k): # ๋‘ ์†Œ์ˆ˜ ์ฐพ๊ธฐ if k%divisor==0: num2=k//divisor num1=divisor if num2์ฒ˜์Œ์— ์ƒ๊ฐํ–ˆ๋˜ ๋ฐฉ์‹์€ ์ฃผ์–ด์ง„ k=143๋ฅผ ์†Œ์ธ์ˆ˜๋ถ„ํ•ด ํ–ˆ์„๋•Œ ์ถ”์ถœ๋˜๋Š” ๋‘ ๊ฐ’์ด ๋ชจ๋‘ l์ด์ƒ์ด..
Yuuuki
'๋ฐฑ์ค€' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก