結果

問題 No.1450 nahco314's First Problem
ユーザー simansiman
提出日時 2021-07-06 19:24:46
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 161 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-26 02:09:43
合計ジャッジ時間 18,842 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
12,160 KB
testcase_01 AC 254 ms
12,672 KB
testcase_02 AC 356 ms
12,672 KB
testcase_03 WA -
testcase_04 AC 98 ms
12,288 KB
testcase_05 AC 254 ms
12,544 KB
testcase_06 AC 703 ms
13,312 KB
testcase_07 AC 404 ms
13,568 KB
testcase_08 AC 710 ms
13,312 KB
testcase_09 AC 401 ms
13,696 KB
testcase_10 AC 409 ms
13,440 KB
testcase_11 AC 398 ms
13,568 KB
testcase_12 AC 400 ms
13,568 KB
testcase_13 AC 390 ms
13,568 KB
testcase_14 AC 393 ms
13,696 KB
testcase_15 AC 400 ms
13,568 KB
testcase_16 AC 391 ms
13,696 KB
testcase_17 AC 393 ms
13,568 KB
testcase_18 AC 717 ms
13,312 KB
testcase_19 AC 396 ms
13,568 KB
testcase_20 AC 401 ms
13,568 KB
testcase_21 AC 391 ms
13,568 KB
testcase_22 AC 697 ms
13,568 KB
testcase_23 AC 399 ms
13,568 KB
testcase_24 AC 386 ms
13,440 KB
testcase_25 AC 392 ms
13,568 KB
testcase_26 AC 396 ms
13,440 KB
testcase_27 AC 393 ms
13,440 KB
testcase_28 AC 385 ms
13,568 KB
testcase_29 AC 402 ms
13,568 KB
testcase_30 AC 395 ms
13,440 KB
testcase_31 AC 698 ms
13,440 KB
testcase_32 AC 407 ms
13,568 KB
testcase_33 AC 704 ms
13,312 KB
testcase_34 AC 397 ms
13,440 KB
testcase_35 AC 702 ms
13,312 KB
testcase_36 AC 699 ms
13,312 KB
testcase_37 AC 397 ms
13,440 KB
testcase_38 AC 380 ms
13,696 KB
testcase_39 AC 395 ms
13,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:14: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

X = gets.to_i

(X - 2 ** 18).upto(X + 2 ** 18) do |n|
  next if n < 0
  m = n.to_s(2).count('1')
  x = n ^ m

  if x == X
    puts n
    exit
  end
end

puts -1
0