結果

問題 No.2192 平方数の下14桁
ユーザー 遭難者遭難者
提出日時 2022-11-14 23:48:02
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 769 bytes
コンパイル時間 1,013 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 76,128 KB
最終ジャッジ日時 2023-10-14 08:33:31
合計ジャッジ時間 6,541 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,152 KB
testcase_01 AC 59 ms
71,264 KB
testcase_02 AC 69 ms
71,136 KB
testcase_03 WA -
testcase_04 AC 62 ms
71,504 KB
testcase_05 AC 64 ms
71,260 KB
testcase_06 AC 62 ms
71,436 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 65 ms
75,800 KB
testcase_10 AC 66 ms
75,832 KB
testcase_11 AC 65 ms
76,040 KB
testcase_12 AC 65 ms
75,924 KB
testcase_13 AC 63 ms
71,264 KB
testcase_14 AC 60 ms
71,588 KB
testcase_15 AC 68 ms
76,128 KB
testcase_16 AC 71 ms
75,684 KB
testcase_17 AC 76 ms
75,792 KB
testcase_18 AC 75 ms
75,768 KB
testcase_19 AC 202 ms
75,640 KB
testcase_20 AC 197 ms
75,876 KB
testcase_21 AC 204 ms
75,888 KB
testcase_22 AC 211 ms
75,892 KB
testcase_23 AC 206 ms
75,920 KB
testcase_24 AC 206 ms
75,968 KB
testcase_25 AC 208 ms
75,736 KB
testcase_26 AC 209 ms
75,888 KB
testcase_27 AC 60 ms
71,380 KB
testcase_28 AC 61 ms
71,452 KB
testcase_29 AC 63 ms
71,324 KB
testcase_30 AC 65 ms
71,604 KB
testcase_31 AC 63 ms
71,272 KB
testcase_32 AC 60 ms
71,456 KB
testcase_33 AC 60 ms
71,384 KB
testcase_34 AC 62 ms
71,296 KB
testcase_35 AC 65 ms
71,264 KB
testcase_36 AC 63 ms
71,268 KB
testcase_37 AC 62 ms
71,256 KB
testcase_38 AC 65 ms
71,472 KB
testcase_39 AC 61 ms
71,132 KB
testcase_40 AC 207 ms
75,832 KB
testcase_41 AC 202 ms
75,772 KB
testcase_42 AC 217 ms
75,792 KB
testcase_43 AC 205 ms
75,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = int(input())
r = int(input())
if r == 0:
    print("YES")
    exit()
def f(pp):
    global mod, r
    ans = True
    e1, e2 = 0, 0
    rr = r
    while rr % pp == 0:
        rr //= pp
        e1 += 1
    while mod % pp == 0:
        mod //= pp
        e2 += 1
    e, ck = min(e1, e2), r
    for _ in range(e):
        ck //= pp
    ans &= e == e2 or (e & 1) == 0
    if pp == 2:
        v2 = min(3, e2)
        v22 = 1 << v2
        ch = e == e2
        for i in range(v22):
            ch |= (i * i - ck) % v22 == 0
        ans &= ch
    else:
        ans &= e == e2 or pow(ck, pp >> 1, pp) == 1
    return ans
pp, ans = 2, True
while pp * pp < mod:
    if mod % pp == 0:
        ans &= f(pp)
    pp += 1
if mod != 1:
    ans &= f(mod)
print("YNEOS"[not ans::2])
0