QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#819182#5. 在线 O(1) 逆元HugeMouse0 0ms0kbC++20235b2024-12-18 13:45:452024-12-18 13:45:48

Judging History

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

  • [2024-12-18 13:45:48]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-12-18 13:45:45]
  • 提交

answer

#include "inv.h"

const int n = 1e8;
int res[n + 1];
void init(int p) {
    res[1] = 1;
    for (int i = 2; i <= n; i++) {
        res[i] = 1ll * (p - p / i) * res[p % i] % p;
    }
}

int inv(int x) {
    return res[x];
}

Details


Pretests


Final Tests

Test #1:

score: 0
Runtime Error

Test #2:

score: 0
Runtime Error

Test #3:

score: 0
Runtime Error

Test #4:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error