QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#288056#5. 在线 O(1) 逆元ScapeGoatTreeCompile Error//C++14270b2023-12-21 17:31:432023-12-21 17:31:45

Judging History

你现在查看的是测评时间为 2023-12-21 17:31:45 的历史记录

  • [2024-11-05 21:56:27]
  • 管理员手动重测本题所有提交记录
  • [2023-12-21 17:31:45]
  • 评测
  • [2023-12-21 17:31:43]
  • 提交

answer

#include "inv.h"
#define int long long
const int MOD=998244353;
const int MAXN=1e8+5;
int inv1[MOD];
void init(int p){
	inv1[1]=1;
	for(int i=2;i<=MOD;i++){
		int k=p/i;
		int r=p%i;
		inv1[i]=1ll*(p-k)*inv1[r]%MOD;
	}
}
int inv(int x){
	return inv1[x];
}

详细

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:11:24: warning: iteration 998244351 invokes undefined behavior [-Waggressive-loop-optimizations]
   11 |                 inv1[i]=1ll*(p-k)*inv1[r]%MOD;
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
answer.code:8:22: note: within this loop
    8 |         for(int i=2;i<=MOD;i++){
      |                     ~^~~~~
/usr/bin/ld: /tmp/ccfH4Upz.o: in function `main':
implementer.cpp:(.text.startup+0x153): undefined reference to `init(int)'
/usr/bin/ld: implementer.cpp:(.text.startup+0x1f8): undefined reference to `inv(int)'
collect2: error: ld returned 1 exit status