티스토리 뷰

1
2
3
4
5
6
7
8
9
10
11
12
13
14
let input = Int(readLine()!)!
for _ in 1...input{
    let sentence = readLine()?.split(separator: " ")
    let repeatCount = Int((sentence?.first!.description)!)!
    let string = (sentence?.last!.description)!
    var result = ""
    for i in 0..<string.count{
        let char = string[string.index(string.startIndex, offsetBy: i)].description
        for _ in 0..<repeatCount{
            result += char
        }
    }
    print(result)
}
cs


'Algorithm > Baekjoon Online Judge' 카테고리의 다른 글

2741번 'N 찍기'  (0) 2018.02.23
2739번 '구구단'  (0) 2018.02.23
2581번 '소수'  (0) 2018.02.23
2577번 '숫자의 개수'  (0) 2018.02.23
2558번 'A + B - 2'  (0) 2018.02.23
댓글
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함