diff --git a/MuchanKim/README.md b/MuchanKim/README.md index 0c15da2..ef134df 100644 --- a/MuchanKim/README.md +++ b/MuchanKim/README.md @@ -4,5 +4,6 @@ |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2025.03.29 | 구현 | [개미](https://www.acmicpc.net/problem/3048)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/3| | 2차시 | 2025.04.11 | 에라토스테네스의채 | [소-난다!](https://www.acmicpc.net/problem/19699)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/10| +| 3차시 | 2025.04.29 | 그리디 | [알바생 강호](https://www.acmicpc.net/problem/1758)|https://github.com/AlgoLeadMe/AlgoLeadMe-14/pull/14| --- diff --git "a/MuchanKim/\352\267\270\353\246\254\353\224\224/\354\225\214\353\260\224\354\203\235\352\260\225\355\230\270.swift" "b/MuchanKim/\352\267\270\353\246\254\353\224\224/\354\225\214\353\260\224\354\203\235\352\260\225\355\230\270.swift" new file mode 100644 index 0000000..d171744 --- /dev/null +++ "b/MuchanKim/\352\267\270\353\246\254\353\224\224/\354\225\214\353\260\224\354\203\235\352\260\225\355\230\270.swift" @@ -0,0 +1,28 @@ +import Foundation + +func solution(_ n: Int, _ tips: [Int]) -> Int { + let sortedTips = tips.sorted(by: >) + + var totalTip = 0 + for i in 0.. 0 { + totalTip += actualTip + } + } + + return totalTip +} + +// 손님 수 입력 +let n = Int(readLine()!)! + +// 각 손님의 팁 입력 +var tips: [Int] = [] +for _ in 0..