結果
問題 | No.305 鍵(2) |
ユーザー | 👑 yumechi |
提出日時 | 2015-11-27 23:44:05 |
言語 | Ruby (3.3.0) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 62 ms |
コンパイル使用メモリ | 11,404 KB |
実行使用メモリ | 31,448 KB |
平均クエリ数 | 51.08 |
最終ジャッジ日時 | 2023-09-23 22:06:23 |
合計ジャッジ時間 | 2,480 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 110 ms
30,812 KB |
testcase_01 | AC | 106 ms
30,740 KB |
testcase_02 | AC | 102 ms
31,392 KB |
testcase_03 | AC | 104 ms
30,688 KB |
testcase_04 | AC | 104 ms
31,312 KB |
testcase_05 | AC | 105 ms
31,448 KB |
testcase_06 | AC | 101 ms
31,260 KB |
testcase_07 | AC | 106 ms
31,296 KB |
testcase_08 | AC | 106 ms
31,104 KB |
testcase_09 | AC | 105 ms
31,308 KB |
testcase_10 | AC | 104 ms
30,680 KB |
testcase_11 | AC | 105 ms
30,688 KB |
testcase_12 | AC | 105 ms
31,156 KB |
コンパイルメッセージ
Syntax OK
ソースコード
res = "" cnt = 0 curdigit = 0 lastnum = -1 while res != "unlocked" do inp = format("%010d", cnt) puts inp STDOUT.flush 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