結果

問題 No.3133 法B逆元
ユーザー 沙耶花
提出日時 2025-05-02 21:24:58
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 4,209 ms
コンパイル使用メモリ 250,620 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-05-02 21:25:03
合計ジャッジ時間 4,401 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000005
#define Inf64 4000000000000000001LL

int main(){
	
	unsigned long long n;
	long long b;
	cin>>n>>b;
	
	long long nn = n % b;
	for(long long i=0;i<=b+5;i++){
		if((nn*i)%b == 1%b){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<"NaN"<<endl;
	
	return 0;
}
0