QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468525#5. 在线 O(1) 逆元yzc358230151Compile Error//C++14275b2024-07-08 21:20:252024-11-05 21:59:57

Judging History

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

  • [2024-11-05 21:59:57]
  • 管理员手动重测本题所有提交记录
  • [2024-07-08 21:20:25]
  • 评测
  • [2024-07-08 21:20:25]
  • 提交

answer

#include"inv.h"
#include<unordered_map>
typedef long long ll;
int MOD;
unordered_map<int,int>Inv;
void init(int p){
	MOD=p,
	Inv[1]=1;
}
int inv(int x){
	if(!x)
		return 0;
	else if(Inv[x])
		return Inv[x];
	else
		return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
}

詳細信息

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:1: error: ‘unordered_map’ does not name a type
    5 | unordered_map<int,int>Inv;
      | ^~~~~~~~~~~~~
answer.code: In function ‘void init(int)’:
answer.code:8:9: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
    8 |         Inv[1]=1;
      |         ^~~
      |         inv
answer.code: In function ‘int inv(int)’:
answer.code:13:17: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
   13 |         else if(Inv[x])
      |                 ^~~
      |                 inv