일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- pandas
- 구현
- xmltodict
- 깊이우선탐색
- 누적합
- 자연어처리
- 수학
- Geocoding
- 백준
- TF-IDF
- 그래프탐색
- GroupBy
- geopy
- 우선순위큐
- 그래프이론
- 비트마스킹
- NLP
- 유클리드
- dp
- 그리디
- 유사도
- 코사인유사도
- 전처리
- 건축물대장정보
- 재귀
- 너비우선탐색
- 공공데이터
- cosine
- 지진대피소
- 분할정복
- Today
- Total
목록전체 글 (58)
정리용
1. n = int(input()) dp = [0 for i in range(n+1)] arr = [0] + list(map(int,input().split())) for i in range(1,n+1): for j in range(1,i+1): dp[i] = max(dp[i], dp[i-j] + arr[j]) #print(dp) print(dp[i]) 2.
1. 코드섦여 import sys input = sys.stdin.readline n = int(input()) dp =[0] * (n+2) dp[1] =1 dp[2] = 2 for i in range(3, n+1): dp[i] = (dp[i-2]+dp[i-1]) % 15746 print(dp[n]) 2. 주의사항 % 15746 를 print 부분에 넣으면 메모리초과가 뜬다
1. 코드섦여 2. 주의사항
1. 코드설명 import math T = int(input()) for _ in range(T): n, m = map(int, input().split()) cnt = math.factorial(m) // (math.factorial(n) * math.factorial(m - n)) print(cnt) 2. 주의사항 nCm 만 알면 풀수있는 간단한 문제
1. 코드설명 n = int(input()) arr = [list(map(int, input().split())) for _ in range(n)] dp=[0]*(n+1) for i in range(n) : dp[i+1] = max(dp[i], dp[i+1]) if i + arr[i][0]

1. 코드 설명 ### 컴퓨터 수 n = int(input()) ### 딕셔너리 key 값 만들기 dic = {} for i in range(1,n+1): dic[i] = [] ### 딕셔너리 key, values 값 채우기 for i in range(int(input())): a,b = map(int,input().split()) dic[a].append(b) dic[b].append(a) #print(dic) #### dic 이 입력되는 과정 ### 큐 생성 및 초항 설정 from collections import deque q = deque([1]) ### 감염 전파 리스트 visited = [0]*(n+1) visited[1]=1 cnt=0 ### 큐 반복 while q : pop = q.popl..
https://www.acmicpc.net/problem/9461 9461번: 파도반 수열 오른쪽 그림과 같이 삼각형이 나선 모양으로 놓여져 있다. 첫 삼각형은 정삼각형으로 변의 길이는 1이다. 그 다음에는 다음과 같은 과정으로 정삼각형을 계속 추가한다. 나선에서 가장 긴 변의 www.acmicpc.net 1. 코드 설명 for _ in range(int(input())) : n = int(input()) arr = [1]*(n+4) arr[0] = 1 arr[1] = 1 arr[2] = 2 for i in range(n) : arr[i+3] = arr[i] + arr[i+1] print(arr[n-2]) 2. 주의사항 없다 시간 제한도 넉넉해서 for문 마다 리스트를 새로 만들수도 있으며 수열도 문제에..
https://www.acmicpc.net/problem/2667 2667번: 단지번호붙이기 과 같이 정사각형 모양의 지도가 있다. 1은 집이 있는 곳을, 0은 집이 없는 곳을 나타낸다. 철수는 이 지도를 가지고 연결된 집의 모임인 단지를 정의하고, 단지에 번호를 붙이려 한다. 여 www.acmicpc.net 1. 코드 설명 from collections import deque n=int(input()) arr = [list(map(int, input())) for _ in range(n)] done =[[0] * n for _ in range(n)] dx = [-1, 1, 0, 0] dy = [0, 0, -1, 1] def bfs (x,y,cnt) : q = deque() q.append((x,y)) ..