QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#713811#5. 在线 O(1) 逆元Mango2011Compile Error//C++20356b2024-11-05 20:36:022024-11-05 22:08:14

Judging History

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

  • [2024-11-05 22:08:14]
  • 管理员手动重测本题所有提交记录
  • [2024-11-05 20:36:02]
  • 评测
  • [2024-11-05 20:36:02]
  • 提交

answer

#include<bits/stdc++.h>
#include "inv.h"
#define ll long long
const ll mod=998244353;
int qp(ll x,int y){
	ll res=1;
	while(y){
		if(y&1){
			res=res*x%mod;
		}
		x=x*x%mod;
		y>>=1;
	}
	return res;
}
int inv[100005];
void init(int P){
   for(int i=0;i<100000;i++){
	   inv[i]=qp(i,mod-2);
   }
}
int inv(int x)
{
 	return inv[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:16:15: error: ‘int inv [100005]’ redeclared as different kind of entity
   16 | int inv[100005];
      |               ^
In file included from answer.code:2:
inv.h:2:5: note: previous declaration ‘int inv(int)’
    2 | int inv(int n);
      |     ^~~
answer.code: In function ‘void init(int)’:
answer.code:19:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   19 |            inv[i]=qp(i,mod-2);
      |                 ^
answer.code:19:18: error: assignment of read-only location ‘*(inv + ((sizetype)i))’
   19 |            inv[i]=qp(i,mod-2);
      |            ~~~~~~^~~~~~~~~~~~
answer.code: In function ‘int inv(int)’:
answer.code:24:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   24 |         return inv[x];
      |                     ^
answer.code:24:21: error: invalid conversion from ‘int (*)(int)’ to ‘int’ [-fpermissive]
   24 |         return inv[x];
      |                     ^
      |                     |
      |                     int (*)(int)