結果

問題 No.305 鍵(2)
ユーザー yozayoza
提出日時 2015-11-27 23:07:49
言語 Ruby
(3.2.2)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 44 ms
コンパイル使用メモリ 11,504 KB
実行使用メモリ 31,404 KB
平均クエリ数 51.08
最終ジャッジ日時 2023-09-23 22:03:37
合計ジャッジ時間 2,622 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
31,404 KB
testcase_01 AC 113 ms
31,024 KB
testcase_02 AC 110 ms
31,124 KB
testcase_03 AC 111 ms
31,236 KB
testcase_04 AC 112 ms
31,340 KB
testcase_05 AC 114 ms
31,320 KB
testcase_06 AC 107 ms
31,276 KB
testcase_07 AC 109 ms
31,392 KB
testcase_08 AC 112 ms
31,300 KB
testcase_09 AC 110 ms
31,088 KB
testcase_10 AC 110 ms
30,768 KB
testcase_11 AC 109 ms
31,288 KB
testcase_12 AC 110 ms
30,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

offset = 0
flag = false
pre = 0
10.times do |i|
  10.times do |j|
    flowNum = j * 10 ** i
    puts '%010d' % (flowNum + offset)
    STDOUT.flush
    hit, state = gets.chomp.split()
    if state == 'unlocked'
      flag = true
      break
    end
    if j == 0
      pre = hit.to_i
    elsif hit.to_i < pre
      offset += (j - 1) * 10 ** i
      break
    elsif hit.to_i > pre
      offset += flowNum
      break
    end
  end
  break if flag
end
0