diff --git a/kangrae-jo/Greedy/11-kangrae-jo.cpp b/kangrae-jo/Greedy/11-kangrae-jo.cpp new file mode 100644 index 0000000..fabfbc4 --- /dev/null +++ b/kangrae-jo/Greedy/11-kangrae-jo.cpp @@ -0,0 +1,28 @@ +#include +#include +#include + +using namespace std; + +int main() { + int N; + cin >> N; + + vector ATM(N); + for (int i = 0; i < N; i++) { + cin >> ATM[i]; + } + + sort(ATM.begin(), ATM.end()); + + int result = 0; + for (int wait = 0; wait < N; wait++) { + for (int use = 0; use <= wait; use++) { + result += ATM[use]; + } + } + + cout << result; + + return 0; +} \ No newline at end of file diff --git a/kangrae-jo/README.md b/kangrae-jo/README.md index d157cfe..00bb584 100644 --- a/kangrae-jo/README.md +++ b/kangrae-jo/README.md @@ -11,5 +11,6 @@ | 7차시 | 2024.11.09 | DP | [1로 만들기](https://www.acmicpc.net/problem/1463)|[#12](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/24|) | 8차시 | 2024.11.12 | HEAP | [더 맵게](https://school.programmers.co.kr/learn/courses/30/lessons/42626)|[#27](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/27|) | 9차시 | 2024.11.23 | DP | [정수 삼각형](https://school.programmers.co.kr/learn/courses/30/lessons/43105)|[#30](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/30|) +| 11차시 | 2024.12.21 | Greedy | [ATM](https://www.acmicpc.net/problem/11399)|[#41](https://github.com/AlgoLeadMe/AlgoLeadMe-12/pull/41|) --- \ No newline at end of file