QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#136492#5. 在线 O(1) 逆元zhouhuanyiCompile Error//C++14497b2023-08-08 21:04:052024-11-05 21:51:30

Judging History

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

  • [2024-11-05 21:51:30]
  • 管理员手动重测本题所有提交记录
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-08 21:04:06]
  • 评测
  • [2023-08-08 21:04:05]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define mod 998244353
#define N 10000000
using namespace std;
int MD2(int x)
{
	return x<0?x+mod:x;
}
int T,invs[N+1];
void init(int p)
{
	invs[1]=1;
	for (int i=2;i<=N;++i) invs[i]=MD2(-1ll*(mod/i)*invs[mod%i]%mod);
	return;
}
int inv(int x)
{
	int a,b;
	if (x<=N) return invs[x];
	else return MD2(-1ll*(mod/x)*inv(mod%x)%mod);
}
int main()
{
	int x;
	cin>>T,init(0);
	while (T--) cin>>x,cout<<1ll*inv(x)*x%mod<<endl;
	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/ccE6ydHI.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccjq8hwI.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status