結果
| 問題 |
No.927 Second Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-22 21:35:21 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 158 ms / 2,000 ms |
| コード長 | 195 bytes |
| コンパイル時間 | 191 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-10-11 02:57:52 |
| 合計ジャッジ時間 | 4,460 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
コンパイルメッセージ
Main.rb:3: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
X = gets.chomp
if X[/^.0*$|^(.)\1*$/]
p -1
else
Y = X.chars.sort*""
(Y.size-1).times{|i|
if Y[i] != Y[i+1]
Y[i], Y[i+1] = Y[i+1], Y[i]
break
end
}
puts Y.reverse
end