結果

問題 No.262 面白くないビットすごろく
ユーザー eigh8_t
提出日時 2015-07-31 23:03:40
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 208 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 19,360 KB
最終ジャッジ日時 2024-07-17 23:22:36
合計ジャッジ時間 3,657 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 1 TLE * 1 -- * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:20: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

n = gets.to_i
sum = 1
i = 1
count = 1
while sum < n
	i = sum
	j = 1
	while i >= j
		sum += 1 if j & i > 0
		j *= 2
	end
	i += 1
	count += 1
	flug = true if sum == n
end

if flug
	puts count
else
	puts -1
end
0