QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489111#5. 在线 O(1) 逆元qwef_Compile Error//C++14269b2024-07-24 18:06:562024-07-24 18:06:56

Judging History

你现在查看的是测评时间为 2024-07-24 18:06:56 的历史记录

  • [2024-11-05 22:01:54]
  • 管理员手动重测本题所有提交记录
  • [2024-07-24 18:06:56]
  • 评测
  • [2024-07-24 18:06:56]
  • 提交

answer

#include "inv.h"
typedef long long ll;
const int N=1e8+114,p=998244353;
int a[N];
void init(int _){
	a[1]=1;
	for(int i=2;i<N;++i) a[i]=(ll)(p-p/i)*a[p%i]%p;
}
int query(int x){
	for(int i=1,j=x;;++i,j=(j+x>=p?j+x-p:j+x))
		if(j<N)
			return (ll)a[j]*i%p;
}

详细

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);
      |         ~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccOqUXly.o: in function `main':
implementer.cpp:(.text.startup+0x1d0): undefined reference to `inv(int)'
collect2: error: ld returned 1 exit status