結果

問題 No.791 うし数列
ユーザー nononaga
提出日時 2020-09-08 21:21:22
言語 Ruby
(3.4.1)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 124 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 7,296 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-30 08:33:47
合計ジャッジ時間 2,810 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:7: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n=gets.chomp
if n == "1" 
    puts -1
elsif n[0] == "1" && n.index(/[^3]/,1) == nil
    puts n.size - 1
else
    puts -1
end
0