QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#819182#5. 在线 O(1) 逆元HugeMouse0 0ms0kbC++20235b2024-12-18 13:45:452024-12-18 13:45:48

Judging History

This is the latest submission verdict.

  • [2024-12-18 13:45:48]
  • Judged
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-12-18 13:45:45]
  • Submitted

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];
}

詳細信息


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