結果
問題 |
No.3 ビットすごろく
|
ユーザー |
![]() |
提出日時 | 2016-11-15 00:57:51 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 364 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-11-26 01:30:32 |
合計ジャッジ時間 | 4,508 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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