結果

問題 No.2 素因数ゲーム
ユーザー らっしー(raccy)らっしー(raccy)
提出日時 2014-12-07 20:29:54
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 651 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 11,520 KB
実行使用メモリ 15,444 KB
最終ジャッジ日時 2023-09-02 09:44:15
合計ジャッジ時間 5,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
15,212 KB
testcase_01 AC 91 ms
15,312 KB
testcase_02 AC 92 ms
15,216 KB
testcase_03 AC 92 ms
15,312 KB
testcase_04 WA -
testcase_05 AC 93 ms
15,180 KB
testcase_06 WA -
testcase_07 AC 92 ms
15,208 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 93 ms
15,332 KB
testcase_11 AC 93 ms
15,400 KB
testcase_12 AC 92 ms
15,272 KB
testcase_13 AC 93 ms
15,416 KB
testcase_14 AC 92 ms
15,164 KB
testcase_15 WA -
testcase_16 AC 93 ms
15,224 KB
testcase_17 AC 91 ms
15,320 KB
testcase_18 AC 93 ms
15,120 KB
testcase_19 AC 93 ms
15,372 KB
testcase_20 WA -
testcase_21 AC 95 ms
15,228 KB
testcase_22 AC 93 ms
15,224 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 91 ms
15,372 KB
testcase_26 AC 92 ms
15,196 KB
testcase_27 AC 92 ms
15,328 KB
testcase_28 AC 93 ms
15,356 KB
testcase_29 AC 93 ms
15,104 KB
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "prime"
divs = Prime.prime_division(gets.to_i)
ds_list = {}
divs.each do |d|
  ds_list[d[1]] = 0 unless ds_list[d[1]]
  ds_list[d[1]] += 1
end
flag = false
if ds_list.size == 1
  flag = true
elsif ds_list.size.even?
  ds_list.each do |key, value|
    if value.odd?
      flag = true
      break
    end
  end
else
  odd_list = []
  ds_list.each do |key, value|
    if value.odd?
      odd_list << key
    end
  end
  odd_list.sort!
  if odd_list.size != 3 ||
      odd_list[0] + 1 != odd_list[1] ||
      odd_list[1] + 1 != odd_list[2]
    flag = true
  end
end
if flag
  puts "Alice"
else
  puts "Bob"
end
0