전체 글
-
1차원 dp를 사용할 땐, 중복 갱신에 주의해야 함(경우에 따라 역순으로 갱신할것)실수모음 2023. 8. 28. 14:29
12865번: 평범한 배낭 첫 줄에 물품의 수 N(1 ≤ N ≤ 100)과 준서가 버틸 수 있는 무게 K(1 ≤ K ≤ 100,000)가 주어진다. 두 번째 줄부터 N개의 줄에 거쳐 각 물건의 무게 W(1 ≤ W ≤ 100,000)와 해당 물건의 가치 V(0 ≤ V ≤ 1,000) www.acmicpc.net 잘못된 코드(19번째 줄에서 dp[w - weight] 이라서 역순으로 갱신해야 함) 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 #include #define endl '\n' // don't use when you cover interactive problem using namespace std; typedef pai..
-
The Irwin-Hall distribution(Probability distribution of a sum of uniform random variables)아무거나적어~ 2023. 7. 31. 16:51
Probability distribution of a sum of uniform random variables Given a random variable $$X = \sum_i^n x_i,$$ where $x_i \in (a_i,b_i)$ are independent uniform random variables, how does one find the probability distribution of $X$? math.stackexchange.com
-
[matplotlib] use latex카테고리 없음 2023. 7. 31. 15:39
https://stackoverflow.com/questions/44333065/string-variable-as-latex-in-pyplot string variable as latex in pyplot It is possible to have Latex formatting in pyplot diagrams, i.e. for title, labels etc. #some dummy code plt.plot(x,y,label = r"$a < \gamma$") It is generated by adding an r before the actual... stackoverflow.com
-
-
[python] np.random.normal 이 왜 정규분포에서 샘플한거임??아무거나적어~ 2023. 7. 30. 18:28
[확률과 통계] 파이썬으로 정규 분포 그리기 - Codetorial 2. 정규 분포 그리기 import numpy as np import matplotlib.pyplot as plt from scipy.special import erf np.random.seed(0) plt.style.use('default') plt.rcParams['figure.figsize'] = (6, 3) plt.rcParams['font.size'] = 12 plt.rcParams['lines.linewidth'] = codetorial.net
-
[python] '리스트 공간 확보 후 원소 대입'과 'list.append를 이용한 원소 삽입' 간 수행 시간 차이아무거나적어~ 2023. 7. 29. 21:08
[0, 1, 2, 3, ...] 와 같은 리스트를 생성해야 할 때, 전체 원소 크기만큼 리스트 공간을 확보 후 원소들을 대입하도록 하자 -> 내부적으로 list가 dynamic array 자료구조(자료구조가 초기에 할당한 배열의 capacity를 넘어설 때 더 큰 배열로 원소들을 옮겨야 됨)이기 때문에 append를 이용한 연산이 더 시간이 많이 걸리는 것으로 보인다 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 N = 10*6 def a(N): ret = [0]*N for i in range(N): ret[i] = i return ret def b(N): ret = [] for i in range(N): ret.append(i) return ret if..
-
[jupyter] !, % command 차이아무거나적어~ 2023. 7. 29. 17:34
https://stackoverflow.com/questions/45784499/what-is-the-difference-between-and-in-jupyter-notebooks What is the difference between ! and % in Jupyter notebooks? Both ! and % allow you to run shell commands from a Jupyter notebook. % is provided by the IPython kernel and allows you to run "magic commands", many of which include well-known shell stackoverflow.com