結果

問題 No.1409 Simple Math in yukicoder
ユーザー GER_chenGER_chen
提出日時 2021-02-27 15:03:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 77,096 KB
最終ジャッジ日時 2024-04-10 15:39:38
合計ジャッジ時間 28,318 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,004 KB
testcase_01 AC 34 ms
53,376 KB
testcase_02 AC 32 ms
53,272 KB
testcase_03 AC 32 ms
52,532 KB
testcase_04 AC 32 ms
52,828 KB
testcase_05 AC 36 ms
52,740 KB
testcase_06 AC 32 ms
53,396 KB
testcase_07 AC 50 ms
66,592 KB
testcase_08 AC 95 ms
76,428 KB
testcase_09 AC 52 ms
66,080 KB
testcase_10 AC 88 ms
76,508 KB
testcase_11 AC 102 ms
76,588 KB
testcase_12 AC 98 ms
76,116 KB
testcase_13 AC 61 ms
67,324 KB
testcase_14 AC 54 ms
66,620 KB
testcase_15 AC 61 ms
69,000 KB
testcase_16 AC 64 ms
68,864 KB
testcase_17 AC 109 ms
76,440 KB
testcase_18 AC 78 ms
76,320 KB
testcase_19 AC 91 ms
76,588 KB
testcase_20 AC 76 ms
76,372 KB
testcase_21 AC 69 ms
74,404 KB
testcase_22 AC 88 ms
76,708 KB
testcase_23 AC 49 ms
64,516 KB
testcase_24 AC 46 ms
63,736 KB
testcase_25 AC 89 ms
76,772 KB
testcase_26 AC 92 ms
76,264 KB
testcase_27 AC 117 ms
76,476 KB
testcase_28 AC 125 ms
76,520 KB
testcase_29 AC 114 ms
76,324 KB
testcase_30 AC 113 ms
76,480 KB
testcase_31 AC 123 ms
76,508 KB
testcase_32 AC 115 ms
76,704 KB
testcase_33 AC 111 ms
76,544 KB
testcase_34 AC 114 ms
77,096 KB
testcase_35 AC 117 ms
76,364 KB
testcase_36 AC 115 ms
76,592 KB
testcase_37 AC 133 ms
76,772 KB
testcase_38 AC 133 ms
76,780 KB
testcase_39 AC 126 ms
77,084 KB
testcase_40 AC 140 ms
76,612 KB
testcase_41 AC 130 ms
76,748 KB
testcase_42 AC 127 ms
76,784 KB
testcase_43 AC 129 ms
76,700 KB
testcase_44 AC 138 ms
76,540 KB
testcase_45 AC 136 ms
76,728 KB
testcase_46 AC 128 ms
77,084 KB
testcase_47 AC 128 ms
76,556 KB
testcase_48 AC 136 ms
77,012 KB
testcase_49 AC 127 ms
76,784 KB
testcase_50 AC 129 ms
76,524 KB
testcase_51 AC 134 ms
76,984 KB
testcase_52 AC 144 ms
76,536 KB
testcase_53 AC 129 ms
76,364 KB
testcase_54 AC 138 ms
76,580 KB
testcase_55 AC 143 ms
76,588 KB
testcase_56 AC 126 ms
76,796 KB
testcase_57 AC 136 ms
76,620 KB
testcase_58 AC 129 ms
76,624 KB
testcase_59 AC 136 ms
76,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def p(m):
    if m == 2:
        return 1
    D = [2]
    x = (m-1)//2
    while x%2 == 0:
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            D.append(i)
            while not x%i:
                x //= i
        i += 2
    if x > 1:
        D.append(x)
    g = 2
    while True:
        if all(pow(g, (m-1)//d, m) != 1 for d in D):
            return g
        g += 1
                
for _ in range(int(input())):
    v, x = map(int, input().split())
    q = v*x+1
    h = pow(p(q), v, q)
    print(*sorted([pow(h, i, q) for i in range(x)]))
0