結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = unsigned long long;
ll N,B;

void solve(){
    N %= B;
    for(ll i = 0;i<B;i++){
        if(((N%B)*(i))%B==1%B){
            cout<<i<<endl;
            return;
        }
    }
    cout<<"NaN"<<endl;
}

signed main(){
    cin >> N >> B;
    solve();
}
0