Skip to content

Commit cd77cdf

Browse files
committed
Lv3_거스름돈
1 parent 7fb1084 commit cd77cdf

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <string>
2+
#include <vector>
3+
4+
using namespace std;
5+
6+
// 그냥 BFS는 시간초과
7+
// DP를 사용하자!
8+
int solution99(int n, vector<int> money) {
9+
int MOD = 1000000007;
10+
int answer = 0;
11+
vector<int> d(n + 1, 0);
12+
d[0] = 1;
13+
14+
for (int i = 0; i < money.size(); i++) {
15+
for (int j = money[i]; j <= n ; j++) {
16+
d[j] = d[j] + d[j - money[i]] % MOD;
17+
}
18+
}
19+
20+
return d[n];
21+
}

Programmers/Programmers.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<ClCompile Include="Lv3\Lv3_4단고음.cpp" />
9898
<ClCompile Include="Lv3\Lv3_가장긴펠린드롬.cpp" />
9999
<ClCompile Include="Lv3\Lv3_가장먼노드.cpp" />
100+
<ClCompile Include="Lv3\Lv3_거스름돈.cpp" />
100101
<ClCompile Include="Lv3\Lv3_네트워크.cpp" />
101102
<ClCompile Include="Lv3\Lv3_단속카메라.cpp" />
102103
<ClCompile Include="Lv3\Lv3_단어변환.cpp" />

Programmers/Programmers.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,5 +318,8 @@
318318
<ClCompile Include="Lv3\Lv3_가장긴펠린드롬.cpp">
319319
<Filter>소스 파일</Filter>
320320
</ClCompile>
321+
<ClCompile Include="Lv3\Lv3_거스름돈.cpp">
322+
<Filter>소스 파일</Filter>
323+
</ClCompile>
321324
</ItemGroup>
322325
</Project>

0 commit comments

Comments
 (0)