結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
|
提出日時 | 2021-06-18 10:48:32 |
言語 | Swift (6.0.3) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 215 bytes |
コンパイル時間 | 1,049 ms |
コンパイル使用メモリ | 119,632 KB |
実行使用メモリ | 9,344 KB |
最終ジャッジ日時 | 2024-06-13 04:58:14 |
合計ジャッジ時間 | 2,070 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
let n = Array(readLine()!).map{String($0)} var c = n.count % 3 == 0 ? 3 : 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))