結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
iceEiji2
|
| 提出日時 | 2016-11-15 00:57:51 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 364 bytes |
| 記録 | |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 14,976 KB |
| 最終ジャッジ日時 | 2026-05-20 13:47:50 |
| 合計ジャッジ時間 | 3,387 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 15 |
コンパイルメッセージ
Syntax OK
ソースコード
gole = gets.to_i
current = 1
root_count = 1
until current >= gole do
move = current.to_s(2).count("1")
root_count += 1
if root_count > gole then
root_count = -1
break
elsif current + move == gole then
break
elsif current + move > gole then
current -= move
elsif current + move < gole then
current += move
end
end
puts root_count
iceEiji2