結果

問題 No.3133 法B逆元
ユーザー ks2m
提出日時 2025-05-02 21:29:32
言語 Java
(openjdk 23)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 2,608 ms
コンパイル使用メモリ 79,500 KB
実行使用メモリ 41,964 KB
最終ジャッジ日時 2025-05-02 21:29:43
合計ジャッジ時間 5,814 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		BigInteger b = sc.nextBigInteger();
		sc.close();

		try {
			BigInteger ans = n.modInverse(b);
			System.out.println(ans);
		} catch (Exception e) {
			System.out.println("NaN");
		}
	}
}
0