結果

問題 No.784 「,(カンマ)」
ユーザー MaboyMaboy
提出日時 2021-06-18 10:46:17
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 192 bytes
コンパイル時間 1,471 ms
コンパイル使用メモリ 107,440 KB
実行使用メモリ 7,732 KB
最終ジャッジ日時 2023-09-04 00:25:26
合計ジャッジ時間 2,195 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
7,396 KB
testcase_02 WA -
testcase_03 AC 3 ms
7,432 KB
testcase_04 AC 3 ms
7,652 KB
testcase_05 WA -
testcase_06 AC 3 ms
7,680 KB
testcase_07 AC 3 ms
7,628 KB
testcase_08 WA -
testcase_09 AC 3 ms
7,616 KB
testcase_10 AC 3 ms
7,732 KB
testcase_11 WA -
testcase_12 AC 3 ms
7,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let n = Array(readLine()!).map{String($0)}
var c = n.count % 3
var s = ""

for i in n{
    s += i
    c -= 1
    if c == 0{
        s += ","
        c = 3
    }
}
print(s.prefix(s.count - 1))
0