結果

問題 No.305 鍵(2)
ユーザー 👑 yumechiyumechi
提出日時 2015-11-27 23:43:35
言語 Ruby
(3.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 518 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,400 KB
実行使用メモリ 43,404 KB
最終ジャッジ日時 2023-09-23 22:10:28
合計ジャッジ時間 6,666 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

res = ""
cnt = 0
curdigit = 0
lastnum = -1
while res != "unlocked" do
    inp = format("%010d", cnt)
    puts inp
    num, res = gets.chomp.split(" ")
    num = num.to_i
    if num == 10
        break
    end
    if lastnum == -1
        cnt += 10 ** curdigit
        lastnum = num
    elsif lastnum < num
        curdigit += 1
        lastnum = -1
    elsif lastnum > num
        cnt -= 10 ** curdigit
        curdigit += 1
        lastnum = -1
    else
        cnt += 10 ** curdigit
        lastnum = num
    end
end
0