結果
| 問題 | No.784 「,(カンマ)」 |
| コンテスト | |
| ユーザー |
object1234
|
| 提出日時 | 2019-02-10 10:19:19 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 2,000 ms |
| コード長 | 239 bytes |
| 記録 | |
| コンパイル時間 | 37 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-07-05 19:07:44 |
| 合計ジャッジ時間 | 1,542 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
コンパイルメッセージ
Syntax OK
ソースコード
a = gets.chomp.chars
count = 0
(a.length - 1).downto(0) do |i|
count += 1 if a[i] =~ /[0-9]/
if count == 3 and i - 1 >= 0
a[i + 1..a.length] = a[i..a.length - 1]
a[i] = ","
count = 0
end
end
puts a.join
object1234