結果

問題 No.1409 Simple Math in yukicoder
ユーザー convexineqconvexineq
提出日時 2021-02-27 07:07:03
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 750 bytes
コンパイル時間 2,454 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 78,628 KB
最終ジャッジ日時 2023-07-26 00:17:21
合計ジャッジ時間 37,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,184 KB
testcase_01 AC 74 ms
71,384 KB
testcase_02 AC 72 ms
71,732 KB
testcase_03 AC 72 ms
71,032 KB
testcase_04 AC 75 ms
71,616 KB
testcase_05 AC 73 ms
71,652 KB
testcase_06 AC 75 ms
71,620 KB
testcase_07 AC 97 ms
76,904 KB
testcase_08 AC 150 ms
78,116 KB
testcase_09 AC 103 ms
76,976 KB
testcase_10 AC 133 ms
77,716 KB
testcase_11 AC 146 ms
78,172 KB
testcase_12 AC 136 ms
77,732 KB
testcase_13 AC 102 ms
77,056 KB
testcase_14 AC 96 ms
77,040 KB
testcase_15 AC 104 ms
76,788 KB
testcase_16 AC 104 ms
77,064 KB
testcase_17 AC 167 ms
78,180 KB
testcase_18 AC 124 ms
77,736 KB
testcase_19 AC 130 ms
77,864 KB
testcase_20 AC 124 ms
77,692 KB
testcase_21 AC 110 ms
76,988 KB
testcase_22 AC 135 ms
77,820 KB
testcase_23 AC 95 ms
76,644 KB
testcase_24 AC 90 ms
77,060 KB
testcase_25 AC 133 ms
77,916 KB
testcase_26 AC 141 ms
77,996 KB
testcase_27 AC 173 ms
78,188 KB
testcase_28 AC 170 ms
78,072 KB
testcase_29 AC 174 ms
78,248 KB
testcase_30 AC 173 ms
78,152 KB
testcase_31 AC 182 ms
78,268 KB
testcase_32 AC 176 ms
78,084 KB
testcase_33 AC 169 ms
78,268 KB
testcase_34 AC 173 ms
77,948 KB
testcase_35 AC 181 ms
78,332 KB
testcase_36 AC 171 ms
78,056 KB
testcase_37 AC 204 ms
78,328 KB
testcase_38 AC 204 ms
78,316 KB
testcase_39 AC 208 ms
78,108 KB
testcase_40 AC 207 ms
77,896 KB
testcase_41 AC 208 ms
78,124 KB
testcase_42 AC 205 ms
78,088 KB
testcase_43 AC 208 ms
78,240 KB
testcase_44 AC 229 ms
78,596 KB
testcase_45 AC 205 ms
78,100 KB
testcase_46 AC 213 ms
78,348 KB
testcase_47 AC 210 ms
78,148 KB
testcase_48 AC 203 ms
77,996 KB
testcase_49 AC 203 ms
77,984 KB
testcase_50 AC 211 ms
78,220 KB
testcase_51 AC 208 ms
78,052 KB
testcase_52 AC 203 ms
78,212 KB
testcase_53 AC 203 ms
78,296 KB
testcase_54 AC 214 ms
78,024 KB
testcase_55 AC 212 ms
78,220 KB
testcase_56 AC 211 ms
78,128 KB
testcase_57 AC 205 ms
78,040 KB
testcase_58 AC 212 ms
78,628 KB
testcase_59 AC 207 ms
77,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def prime_factors(N): #素因数のリスト
    factors = []
    if N&1==0:
        factors = [2]
        while N%2 == 0: N //= 2
    else: factorization = []
    M = int(N**0.5)+1
    for i in range(3,M,2):
        if N%i==0:
            while N%i == 0: N //= i
            factors.append(i)
    if N!= 1: factors.append(N)
    assert N != 0, "zero"
    return factors

def solve(v,x):
    p = v*x+1
    ps = prime_factors(v)+prime_factors(x)
    r = 1
    for r in range(2,p):
        for pp in ps:
            if pow(r,v*x//pp,p) == 1:
                break
        else:
            break
    a = [pow(r,i*v,p) for i in range(x)]
    return sorted(a)

T = int(input())
for _ in range(T):
    v,x = map(int,input().split())
    print(*solve(v,x))
0