結果

問題 No.1409 Simple Math in yukicoder
ユーザー aaaaaaaaaa2230
提出日時 2021-02-27 11:23:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 503 ms / 2,000 ms
コード長 393 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,184 KB
最終ジャッジ日時 2024-10-02 17:23:10
合計ジャッジ時間 40,436 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())

for _ in range(t):
    v,x = map(int,input().split())
    mod = v*x+1
    for i in range(1,mod):
        if pow(i,x,mod) != 1:
            continue
        s = set()
        now = i
        for j in range(x):
            s.add(now)
            now *= i
            now %= mod
        if len(s) == x:
            ans = sorted(list(s))
            print(*ans)
            break
0