結果
| 問題 |
No.355 数当てゲーム(2)
|
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-06-14 10:05:44 |
| 言語 | Ruby (3.4.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 406 bytes |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 29,528 KB |
| 平均クエリ数 | 98.50 |
| 最終ジャッジ日時 | 2024-07-17 11:30:18 |
| 合計ジャッジ時間 | 17,471 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 52 |
コンパイルメッセージ
Main.rb:24: warning: assigned but unused variable - b Syntax OK
ソースコード
def send_query(nums)
STDOUT.puts(nums.join(' '))
STDOUT.flush
a, b = gets.chomp.split.map(&:to_i)
[a, b]
end
nums = [*0..9]
[*0..9].combination(2) do |blo|
nums = [*0..9] - blo
c = 0
a, b = send_query(nums[0..3])
c += a + b
a, b = send_query(nums[4..7])
c += a + b
if c == 4
nums -= blo
end
end
nums.permutation(4) do |list|
a, b = send_query(list)
break if a == 4
end
siman