結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,352 KB
testcase_01 AC 81 ms
15,588 KB
testcase_02 AC 81 ms
15,380 KB
testcase_03 AC 76 ms
15,336 KB
testcase_04 AC 76 ms
15,544 KB
testcase_05 AC 76 ms
15,304 KB
testcase_06 AC 78 ms
15,584 KB
testcase_07 WA -
testcase_08 AC 83 ms
15,332 KB
testcase_09 WA -
testcase_10 AC 76 ms
15,512 KB
testcase_11 AC 78 ms
15,304 KB
testcase_12 AC 78 ms
15,348 KB
testcase_13 AC 79 ms
15,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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