結果

問題 No.1409 Simple Math in yukicoder
ユーザー ygd.ygd.
提出日時 2021-02-26 22:53:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 77,440 KB
最終ジャッジ日時 2024-04-10 13:33:11
合計ジャッジ時間 35,950 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
52,624 KB
testcase_01 AC 33 ms
52,236 KB
testcase_02 AC 33 ms
53,012 KB
testcase_03 AC 32 ms
52,148 KB
testcase_04 AC 33 ms
51,960 KB
testcase_05 AC 31 ms
53,352 KB
testcase_06 AC 32 ms
52,420 KB
testcase_07 AC 83 ms
73,968 KB
testcase_08 AC 159 ms
76,416 KB
testcase_09 AC 73 ms
71,504 KB
testcase_10 AC 136 ms
76,604 KB
testcase_11 AC 144 ms
76,320 KB
testcase_12 AC 126 ms
76,500 KB
testcase_13 AC 84 ms
74,928 KB
testcase_14 AC 84 ms
73,652 KB
testcase_15 AC 94 ms
76,388 KB
testcase_16 AC 86 ms
74,024 KB
testcase_17 AC 181 ms
76,448 KB
testcase_18 AC 113 ms
75,932 KB
testcase_19 AC 124 ms
76,448 KB
testcase_20 AC 110 ms
76,420 KB
testcase_21 AC 101 ms
76,048 KB
testcase_22 AC 136 ms
76,212 KB
testcase_23 AC 75 ms
74,724 KB
testcase_24 AC 60 ms
68,380 KB
testcase_25 AC 120 ms
76,232 KB
testcase_26 AC 142 ms
76,676 KB
testcase_27 AC 208 ms
76,824 KB
testcase_28 AC 189 ms
76,308 KB
testcase_29 AC 206 ms
76,572 KB
testcase_30 AC 192 ms
76,652 KB
testcase_31 AC 203 ms
76,436 KB
testcase_32 AC 203 ms
76,192 KB
testcase_33 AC 198 ms
76,268 KB
testcase_34 AC 201 ms
76,572 KB
testcase_35 AC 191 ms
76,132 KB
testcase_36 AC 202 ms
76,540 KB
testcase_37 AC 397 ms
76,444 KB
testcase_38 AC 414 ms
76,332 KB
testcase_39 AC 406 ms
76,504 KB
testcase_40 AC 411 ms
76,536 KB
testcase_41 AC 396 ms
76,492 KB
testcase_42 AC 407 ms
76,360 KB
testcase_43 AC 388 ms
76,500 KB
testcase_44 AC 418 ms
76,272 KB
testcase_45 AC 404 ms
76,168 KB
testcase_46 AC 402 ms
77,440 KB
testcase_47 AC 375 ms
76,312 KB
testcase_48 AC 395 ms
76,800 KB
testcase_49 AC 388 ms
76,684 KB
testcase_50 AC 415 ms
76,540 KB
testcase_51 AC 385 ms
76,612 KB
testcase_52 AC 383 ms
76,552 KB
testcase_53 AC 369 ms
76,584 KB
testcase_54 AC 394 ms
76,492 KB
testcase_55 AC 396 ms
76,332 KB
testcase_56 AC 374 ms
76,552 KB
testcase_57 AC 425 ms
76,712 KB
testcase_58 AC 429 ms
76,176 KB
testcase_59 AC 443 ms
76,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    v,x = map(int,input().split())
    p = v*x + 1
    for i in reversed(range(1,p+1)):
        if pow(i,x,p) != 1:
            continue
        S = set([])
        S.add(i)
        ni = i*i%p
        while ni not in S:
            S.add(ni)
            ni = ni*i%p
        #print(i,S)
        if len(S) == x:
            L = list(S)
            L.sort()
            print(*L)
            break
0