-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
💬 문제
[코딩테스트 연습 - 직사각형 별찍기](https://school.programmers.co.kr/learn/courses/30/lessons/12969)
💬 풀이
let n = readLine()!.components(separatedBy: [" "]).map { Int($0)! }
let (a, b) = (n[0], n[1])
var s = ""
for _ in 1...b {
for _ in 1...a {
s += "*"
}
s += "\n"
}
print(s)
💬 더 나은 방법?
let n = readLine()!.components(separatedBy: [" "]).map { Int($0)! }
let (a, b) = (n[0], n[1])
for _ in 0..<b {
print(Array(repeating: "*", count: a).joined())
}