QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489165#5. 在线 O(1) 逆元qwef_Compile Error//C++14349b2024-07-24 18:44:422024-11-05 22:01:57

Judging History

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

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

answer

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

详细

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:5:8: error: ‘iny’ does not name a type; did you mean ‘int’?
    5 | inline iny add(int& a,int b){a=(a+b>=p?a+b-p:a+b);}
      |        ^~~
      |        int
answer.code: In function ‘int inv(int)’:
answer.code:11:30: error: ‘add’ was not declared in this scope
   11 |         for(int i=1,j=x;;++i,add(j,x))
      |                              ^~~