QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#179894#5. 在线 O(1) 逆元Summer_SheepCompile Error//C++14351b2023-09-15 12:50:582024-11-05 21:52:22

Judging History

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

  • [2024-11-05 21:52:22]
  • 管理员手动重测本题所有提交记录
  • [2023-09-15 12:50:59]
  • 评测
  • [2023-09-15 12:50:58]
  • 提交

answer

#include<bits/stdc++.h>
#include "inv.h"
#define int long long
using namespace std;
const int mod=998244353;
int qpow(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)
		{
			res*=a;
			res%=mod;
			b--;
		}
		a*=a;
		a%=mod;
		b/=2;
	}
	return res;
}
void init(int p)
{
	mod=p;
}
int inv(int x)
{
	return qpow(x,mod-2);
}

詳細信息

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(long long int)’:
answer.code:25:12: error: assignment of read-only variable ‘mod’
   25 |         mod=p;
      |         ~~~^~