結果

問題 No.3133 法B逆元
ユーザー ldsyb
提出日時 2025-05-02 21:30:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 403 bytes
コンパイル時間 5,927 ms
コンパイル使用メモリ 332,296 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-02 21:31:03
合計ジャッジ時間 6,274 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

int main()
{
    uint64_t n, b;
    cin >> n >> b;

    if (gcd(n, b) != 1)
    {
        cout << "NaN" << endl;
        return 0;
    }

    using mint = modint;
    mint::set_mod(b);

    cout << mint(n).inv().val() << endl;

    return 0;
}
0