QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#534319#5. 在线 O(1) 逆元surgutti0 0ms0kbC++14238b2024-08-27 02:06:322024-11-05 22:03:15

Judging History

This is the latest submission verdict.

  • [2024-11-05 22:03:15]
  • 管理员手动重测本题所有提交记录
  • Verdict: 0
  • Time: 0ms
  • Memory: 0kb
  • [2024-08-27 02:06:32]
  • Judged
  • Verdict: 0
  • Time: 890ms
  • Memory: 394528kb
  • [2024-08-27 02:06:32]
  • Submitted

answer

#include "inv.h"

const int N = 100000000 + 1;

int inverse[N];

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

int inv(int x) {
	return inverse[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