Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c8d67cb

Browse files
committed
Lv2_피로도
1 parent f4c1b65 commit c8d67cb

File tree

4 files changed

+377
-297
lines changed

4 files changed

+377
-297
lines changed

‎Programmers/Lv2/Lv2_피로도.cpp

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#include <string>
2+
#include <vector>
3+
#include <iostream>
4+
using namespace std;
5+
6+
int answer;
7+
8+
void dfs(int hp, int cnt, vector<bool> check, vector<vector<int>> dungeons) {
9+
if (answer < cnt)
10+
answer = cnt;
11+
12+
for (int i = 0; i < dungeons.size(); ++i) {
13+
if (!check[i] && hp >= dungeons[i][0]) {
14+
check[i] = true;
15+
dfs(hp - dungeons[i][1], cnt + 1, check, dungeons);
16+
check[i] = false;
17+
}
18+
}
19+
}
20+
21+
int solution(int k, vector<vector<int>> dungeons) {
22+
vector<bool> check(dungeons.size(), false);
23+
24+
dfs(k, 0, check, dungeons);
25+
26+
return answer;
27+
}
28+
29+
int main() {
30+
int k = 80;
31+
vector<vector<int>> dungeons = {{80, 20}, {50, 40}, {30, 10}};
32+
cout << solution(k, dungeons);
33+
return 0;
34+
}

‎Programmers/Programmers.vcxproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.props')" />
34
<ItemGroup Label="ProjectConfigurations">
45
<ProjectConfiguration Include="Debug|Win32">
56
<Configuration>Debug</Configuration>
@@ -313,6 +314,9 @@
313314
<ClCompile Include="Lv2\Lv2_프린터.cpp">
314315
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
315316
</ClCompile>
317+
<ClCompile Include="Lv2\Lv2_피로도.cpp">
318+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
319+
</ClCompile>
316320
<ClCompile Include="Lv2\Lv2_피보나치수.cpp">
317321
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
318322
</ClCompile>
@@ -554,6 +558,9 @@
554558
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
555559
</ClCompile>
556560
</ItemGroup>
561+
<ItemGroup>
562+
<None Include="packages.config" />
563+
</ItemGroup>
557564
<PropertyGroup Label="Globals">
558565
<VCProjectVersion>15.0</VCProjectVersion>
559566
<ProjectGuid>{8AD8F2CB-4DFD-4C56-A53F-558099E76E3C}</ProjectGuid>
@@ -658,5 +665,13 @@
658665
</ItemDefinitionGroup>
659666
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
660667
<ImportGroup Label="ExtensionTargets">
668+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.targets')" />
661669
</ImportGroup>
670+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
671+
<PropertyGroup>
672+
<ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
673+
</PropertyGroup>
674+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
675+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.210806.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
676+
</Target>
662677
</Project>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /