結果

問題 No.882 約数倍数
ユーザー HimatsubushinHimatsubushin
提出日時 2022-02-08 13:42:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 500 ms
コード長 685 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 11,028 KB
実行使用メモリ 8,008 KB
最終ジャッジ日時 2023-09-05 11:26:58
合計ジャッジ時間 1,083 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,884 KB
testcase_01 AC 17 ms
7,824 KB
testcase_02 AC 16 ms
7,900 KB
testcase_03 AC 17 ms
7,936 KB
testcase_04 AC 16 ms
7,824 KB
testcase_05 AC 16 ms
8,008 KB
testcase_06 AC 16 ms
7,980 KB
testcase_07 AC 16 ms
7,824 KB
testcase_08 AC 16 ms
7,832 KB
testcase_09 AC 16 ms
7,884 KB
testcase_10 AC 15 ms
7,800 KB
testcase_11 AC 16 ms
7,988 KB
testcase_12 AC 16 ms
7,880 KB
testcase_13 AC 16 ms
7,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def primeCheck(n):
    prime = []
    s = [0, 0, 2]
    for i in range(3, n + 1, 2):
        s.append(i)
        s.append(0)
    for i in range(3, n + 1, 2):
        if s[i] != 0:
            j = 3
            while i * j <= n:
                s[i * j] = 0
                j += 2
    for m in s:
        if m > 0:
            prime.append(m)

    for m in prime:
        if m % n:
            primeFactor.append(n)

a, b = map(int, input().split())
if a != b:
    primeFactor = []
    primeCheck(a)
    check = False
    for num in primeFactor:
        if num % b == 0:
            check = True
            break
else:
    check = True

if check:
    print('YES')
else:
    print('NO')
0