結果
| 問題 | No.3133 法B逆元 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-05-02 21:26:31 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 322 ms / 2,000 ms |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 229 ms |
| コンパイル使用メモリ | 96,224 KB |
| 実行使用メモリ | 93,596 KB |
| 最終ジャッジ日時 | 2026-07-10 10:43:55 |
| 合計ジャッジ時間 | 6,331 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n,b = map(int,input().split())
if math.gcd(n,b) != 1:
exit(print('NaN'))
z = 0
for i in range(1,b):
if math.gcd(b,i) == 1:
z += 1
print(pow(n,z-1,b))