QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#609892#5. 在线 O(1) 逆元Yyyyazs0 0ms3836kbC++14465b2024-10-04 14:21:122024-11-05 22:04:22

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 22:04:22]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:3836kb
  • [2024-10-04 14:21:13]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3796kb
  • [2024-10-04 14:21:12]
  • 提交

answer

#include "inv.h"
#include <iostream>

using namespace std;
using ll = long long;
ll p = 998244353;

ll multi(ll a,ll b){
    return (a % p * (b % p)) % p;

}
ll add(ll a, ll b){

}
void init(int p){
    cin >> p;
}

ll qpow(ll a, ll b){
    ll ans = 1;
    while (b){
        if(b & 1)ans = multi(ans,a);
        b >>= 1;
        a = multi(a,a);
    }
    return ans;
}

int inv(int x){
    init(p);
    return multi(x,qpow(x,p-2));
}

Details


Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3816kb

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3752kb

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 3820kb

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 3832kb

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3836kb