일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 딕셔너리
- 백준
- level2
- N과M
- 힙
- 파이썬
- BFS
- level3
- 그리디
- programmers
- 프로그래머스
- 구현
- DP
- 재귀
- 에라스토테네스의 체
- BOJ
- 가상메모리 관리
- 수학
- 가상메모리
- 브루트포스
- 다이나믹 프로그래밍
- level1
- 운영체제
- level0
- 코딩테스트
- 다익스트라
- dfs
- python
- MYSQL
- 스택
- Today
- Total
목록전체 글 (447)
동캄의 코딩도장
https://www.acmicpc.net/problem/13335 생각보다 시간이 오래 걸렸다. 알고리즘은 간단한데.. 구현하는게 생각보다 어려웠다.#백준 13335 트럭from collections import dequen,w,l=map(int,input().split()) # 트럭수, 통과시간, 제한하중trucks=list(map(int,input().split())) #트럭 배열 저장trucks=deque(trucks) # 트럭 배열 덱으로 변환truck_on_brdg=deque([]) # 다리위에 있는 트럭 덱 초기화ans=0 #정답 (총 시간간)total_weight=0 # 총 무게 def search(): global ans global total_weight i=0 w..
https://www.acmicpc.net/problem/1182# 백준 1182 부분수열의 합N,S=map(int,input().split())lst=list(map(int,input().split()))lst.sort() #정렬ans=0 #정답def search(start): global ans if s and sum(s)==S: #S와 부분집합의 합이 같다면 ans+=1 #정답 갯수 증가 for i in range(start,N): if visit[i]==0: #방문하지 않았다면 s.append(lst[i]) #배열에 추가 visit[i]=1 #방문확인 search(i) #재귀적으로 탐색하되, 이전에..
https://www.acmicpc.net/problem/1547# 백준 1547 공N=int(input())dic_cup={1:True,2:False,3:False}for _ in range(N): a_cup,b_cup=map(int,input().split()) temp=dic_cup[a_cup] dic_cup[a_cup]=dic_cup[b_cup] dic_cup[b_cup]=tempif dic_cup[1]==True: print(1)elif dic_cup[2]==True: print(2)elif dic_cup[3]==True: print(3)
https://www.acmicpc.net/problem/15665 #백준 15664 N과M (11)from collections import dequen,m=map(int,input().split())lst=list(map(int,input().split()))lst.sort()s=deque()ans=[]def search(): if len(s)==m: #길이를 만족하면 ans.append(' '.join(map(str,s))) #정답 배열에 저장 return for i in range(n): #배열에 추가 s.append(lst[i]) search() s.pop()search()ans=set(ans) #중복 제거result=[]..
https://www.acmicpc.net/problem/15664 #백준 15664 N과M (10)from collections import dequen,m=map(int,input().split())lst=list(map(int,input().split()))lst.sort()s=deque()ans=[]def search(visit): if len(s)==m: #길이를 만족하면 ans.append(' '.join(map(str,s))) #정답 배열에 저장 return for i in range(n): if visit[i]==1: # 방문했다면 추가로 방문하지 않음 continue if not s: #배열에 원소가 없다면 ..
https://www.acmicpc.net/problem/1021 # 백준 1021 회전하는 큐from collections import dequeN,M=map(int,input().split())numbers=list(map(int,input().split()))queue=deque([i for i in range(1,N+1)])ans=0for find_num in numbers: l=len(queue) find_num_ind=queue.index(find_num) if find_num_ind 진짜 덱을 구현하면 된다.