[Swift] 백준 12047번 동전 0
import Foundation
var input = readLine()!.components(separatedBy: " ").map { Int(String($0))! }
var k = input[1]
var coins: [Int] = []
var result = 0
for _ in 1...input[0] {
coins.append(Int(readLine()!)!)
}
coins.reverse()
for i in 0...input[0] - 1 {
result += k / coins[i]
k %= coins[i]
}
print(result)