結果

問題 No.3133 法B逆元
ユーザー タケタニユウキ
提出日時 2025-06-26 19:58:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 903 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 105,212 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-26 19:58:12
合計ジャッジ時間 3,094 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 10 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<iomanip>
#include<cmath>
#include<string>
#include<queue>
#include<map>
#include<stack>
#include<limits.h>
#include<bit>
#include<bitset>

using namespace std;

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
#define infl LLONG_MAX
#define infi INT32_MAX

void de(ll n){cout << n << endl;}
typedef pair<ll, ll> P;

#define all(a) (a).begin(), (a).end()

void cincout(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout<< fixed << setprecision(15);
}


int main(){
    cincout();
    ll N, B;
    cin >> N >> B;
    N %= B;
    cout << N << endl;
    if(B == 1){
        cout << 0 << endl;
        return 0;
    }
    rep(i, B){
        if(N * (i + 1) % B == 1){
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << "NaN" << endl;
}
0