QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#640872#5. 在线 O(1) 逆元masterhuangCompile Error//C++20411b2024-10-14 16:37:492024-11-05 22:05:43

Judging History

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

  • [2024-11-05 22:05:43]
  • 管理员手动重测本题所有提交记录
  • [2024-10-14 16:37:49]
  • 评测
  • [2024-10-14 16:37:49]
  • 提交

answer


#include<bits/stdc++.h>
using namespace std;
const int N=1e7+5,mod=998244353;
int n=N-5,I[N];
void init(int p)
{
	I[1]=1;
	for(int i=2;i<=n;i++) I[i]=(mod-1ll*(mod/i)*I[mod%i])%mod;
}
int inv(int x)
{
	if(x<=n) return I[x];int q=mod/x,r=mod%x;
	// if(r<x/2) 
	return mod-1ll*q*inv(r)%mod;
	// return 1ll*(q+1)*inv(x-r)%mod;
}
int main()
{
	init(0);
	cout<<2ll*inv(mod-2)%mod;
	return 0;
}

詳細信息

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/ccMulDdZ.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8sp2C2.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status