結果

問題 No.3133 法B逆元
ユーザー Taka
提出日時 2024-03-03 19:28:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 560 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 76,032 KB
最終ジャッジ日時 2025-05-02 20:50:30
合計ジャッジ時間 11,300 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

# import
import time

# input
N, B = map(int, input().split())
start_time = time.time()

if N == 0:
    print('NaN')

else:
    N = N % B
    K = 0
    
    while True:
        current_time = time.time()
        elapsed_time = current_time - start_time
        if elapsed_time >= 1.9:
            print('NaN')
            break
        
        if N == 0:
            ans = 0
            print(ans)
            break
        elif (K * B + 1) % N == 0:
            ans = (K * B + 1) // N
            print(ans)
            break
        else:
            K += 1
0