QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#241463#5. 在线 O(1) 逆元mfeitveer0 0ms0kbC++14375b2023-11-06 08:04:032024-11-05 21:54:44

Judging History

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

  • [2024-11-05 21:54:44]
  • 管理员手动重测本题所有提交记录
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-11-06 08:04:05]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2023-11-06 08:04:03]
  • 提交

answer

#include "inv.h"

const int N = 100000010;
const int mod = 998244353;

typedef long long ll;

ll Inv[N];

ll ask(ll x) {
    return (x <= 100000000 ? Inv[x] : (mod - mod / x) * ask(mod % x) % mod);
}

void init(int p) {
	Inv[1] = 1;
	for(int i = 2;i <= 100000000;i++)
		Inv[i] = (mod - mod / i) * Inv[mod % i] % mod;
}

int inv(int x) {
	return ask(x);
}

详细


Pretests


Final Tests

Test #1:

score: 0
Memory Limit Exceeded

Test #2:

score: 0
Memory Limit Exceeded

Test #3:

score: 0
Memory Limit Exceeded

Test #4:

score: 0
Memory Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded