結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-10-07 19:27:29 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 212 bytes |
| コンパイル時間 | 138 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 24,448 KB |
| 最終ジャッジ日時 | 2024-07-20 01:56:05 |
| 合計ジャッジ時間 | 7,264 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 1 TLE * 1 -- * 29 |
コンパイルメッセージ
Main.rb:12: warning: mismatched indentations at 'end' with 'else' at 10 Syntax OK
ソースコード
N=gets.to_i
current=1
count=0
while current != N && N != 4 do
count+=1
i = current.to_s(2).count("1").to_i
if current+i > N
current -= i
else
current += i
end
end
if N==4
p "-1"
else
p count + 1
end