File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < string>
2+ #include < vector>
3+ using namespace std ;
4+
5+ int solution89 (vector<int > budgets, int M) {
6+ int answer = -1 ;
7+ int sum = 0 ;
8+ int temp = 0 ;
9+ for (int i = 0 ; i < budgets.size (); i++) {
10+ if (answer < budgets[i])
11+ answer = budgets[i];
12+ sum += budgets[i];
13+ }
14+ temp = sum;
15+ while (temp > M) {
16+ temp = sum;
17+ answer--;
18+ for (int i = 0 ; i < budgets.size (); i++) {
19+ if (answer < budgets[i])
20+ temp -= budgets[i] - answer;
21+ }
22+ }
23+
24+ return answer;
25+ }
Original file line number Diff line number Diff line change 102102 <ClCompile Include =" Lv3\Lv3_베스트앨범.cpp" />
103103 <ClCompile Include =" Lv3\Lv3_섬연결하기.cpp" />
104104 <ClCompile Include =" Lv3\Lv3_여행경로.cpp" />
105+ <ClCompile Include =" Lv3\Lv3_예산.cpp" />
105106 <ClCompile Include =" Lv3\Lv3_이중우선순위큐.cpp" />
106107 <ClCompile Include =" Lv3\Lv3_저울.cpp" />
107108 <ClCompile Include =" Lv3\Lv3_정수삼각형.cpp" />
Original file line number Diff line number Diff line change 279279 <ClCompile Include =" Lv3\Lv3_여행경로.cpp" >
280280 <Filter >소스 파일</Filter >
281281 </ClCompile >
282+ <ClCompile Include =" Lv3\Lv3_예산.cpp" >
283+ <Filter >소스 파일</Filter >
284+ </ClCompile >
282285 </ItemGroup >
283286</Project >
You can’t perform that action at this time.
0 commit comments