結果

問題 No.1409 Simple Math in yukicoder
ユーザー marroncastle
提出日時 2021-02-26 23:12:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 484 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-10-02 16:06:09
合計ジャッジ時間 39,542 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
  v, x = map(int, input().split())
  p = v*x+1
  for i in range(1,p+1):
    if pow(i,x,p)==1:
      s = set()
      a = i
      for _ in range(x):
        s.add(a)
        a *= i
        a %= p
      if len(s)==x:
        ans = sorted(list(s))
        break
  print(*ans)
0