結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
15,504 KB
testcase_01 AC 77 ms
15,572 KB
testcase_02 AC 77 ms
15,528 KB
testcase_03 AC 76 ms
15,408 KB
testcase_04 AC 78 ms
15,476 KB
testcase_05 AC 78 ms
15,580 KB
testcase_06 AC 84 ms
15,364 KB
testcase_07 WA -
testcase_08 AC 76 ms
15,572 KB
testcase_09 WA -
testcase_10 AC 80 ms
15,564 KB
testcase_11 AC 79 ms
15,296 KB
testcase_12 AC 81 ms
15,524 KB
testcase_13 AC 77 ms
15,468 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

require "prime"
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