QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#188480#5. 在线 O(1) 逆元EnofTaiPeopleCompile Error//C++14382b2023-09-25 21:20:262024-11-05 21:52:24

Judging History

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

  • [2024-11-05 21:52:24]
  • 管理员手动重测本题所有提交记录
  • [2023-09-25 21:20:27]
  • 评测
  • [2023-09-25 21:20:26]
  • 提交

answer

#include<bits/stdc++.h>
#include "inv.h"
using namespace std;
const int N=1e8+8,M=998244353;
int nv[N];
void init(int p){
	int x;
	nv[0]=nv[1]=1;
	for(x=2;x<N;++x)
		nv[x]=ll(M-M/x)*nv[M%x]%M;
}
int sol(int d){
	if(d<N)return nv[d];
	if(d<M-d){
		return ll(M-M/d)*sol(M%d)%M;
	}else{
		d=M-d;
		return ll(M/d)*sol(M%d)%M;
	}
}
int inv(int x){
	return sol(x);
}

詳細信息

implementer.cpp: In function ‘int main()’:
implementer.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
answer.code: In function ‘void init(int)’:
answer.code:10:23: error: ‘ll’ was not declared in this scope
   10 |                 nv[x]=ll(M-M/x)*nv[M%x]%M;
      |                       ^~
answer.code: In function ‘int sol(int)’:
answer.code:15:24: error: ‘ll’ was not declared in this scope
   15 |                 return ll(M-M/d)*sol(M%d)%M;
      |                        ^~
answer.code:18:24: error: ‘ll’ was not declared in this scope
   18 |                 return ll(M/d)*sol(M%d)%M;
      |                        ^~