結果

問題 No.791 うし数列
ユーザー nononaganononaga
提出日時 2020-09-08 21:21:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 124 bytes
コンパイル時間 623 ms
コンパイル使用メモリ 11,188 KB
実行使用メモリ 15,284 KB
最終ジャッジ日時 2023-08-20 07:42:05
合計ジャッジ時間 2,968 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,160 KB
testcase_01 AC 80 ms
15,268 KB
testcase_02 AC 80 ms
15,132 KB
testcase_03 AC 80 ms
15,264 KB
testcase_04 AC 79 ms
15,284 KB
testcase_05 AC 78 ms
15,260 KB
testcase_06 AC 80 ms
15,068 KB
testcase_07 AC 78 ms
15,128 KB
testcase_08 AC 79 ms
15,176 KB
testcase_09 AC 79 ms
15,168 KB
testcase_10 AC 78 ms
15,256 KB
testcase_11 AC 80 ms
15,068 KB
testcase_12 AC 78 ms
15,136 KB
testcase_13 AC 79 ms
15,108 KB
testcase_14 AC 81 ms
15,192 KB
testcase_15 AC 79 ms
15,204 KB
testcase_16 AC 80 ms
15,156 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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