結果

問題 No.882 約数倍数
ユーザー KisaragiEffectiveKisaragiEffective
提出日時 2020-11-08 18:18:26
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 256 bytes
コンパイル時間 65 ms
コンパイル使用メモリ 11,420 KB
実行使用メモリ 15,640 KB
最終ジャッジ日時 2023-09-29 21:33:36
合計ジャッジ時間 2,371 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,340 KB
testcase_01 AC 77 ms
15,368 KB
testcase_02 AC 76 ms
15,348 KB
testcase_03 AC 80 ms
15,384 KB
testcase_04 AC 77 ms
15,364 KB
testcase_05 AC 75 ms
15,588 KB
testcase_06 AC 78 ms
15,292 KB
testcase_07 WA -
testcase_08 AC 78 ms
15,388 KB
testcase_09 WA -
testcase_10 AC 78 ms
15,492 KB
testcase_11 AC 78 ms
15,292 KB
testcase_12 AC 77 ms
15,304 KB
testcase_13 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "prime"
require "set"
A,B = gets.split.map(&:to_i)
# Aの正負の約数を列挙してSetに包む
v = Set.new(Prime.prime_division(A).map {|x| (0..x[1]).map{|e| x[0]**e}}.flatten.uniq.map{|x| [x] + [-x]}.flatten)
puts v.include?(B) ? "YES" : "NO"
0