結果

問題 No.1298 OR XOR
コンテスト
ユーザー horiesiniti
提出日時 2023-01-19 00:57:40
言語 Ruby
(4.0.1)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 291 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 58 ms
コンパイル使用メモリ 9,088 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2026-03-05 05:02:13
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #
raw source code

n=gets.to_i.digits(2).reverse
i=0
if n.count{|e| e==1}==1 then
	puts "-1 -1 -1"
else
	as=["","",""]
	i=0
	n.each{|e|
		s="000"
		if e==0 then
		elsif i%2==0 
			s="110"
			i+=1
		else
			s="101"
			i+=1
		end
		3.times{|i|
			as[i]+=s[i]
		}
	}
	puts as.map{|e| e.to_i(2)}.sort.join(" ")
end
0