QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#468523#5. 在线 O(1) 逆元yzc358230151Compile Error//C++14227b2024-07-08 21:19:322024-11-05 21:59:53

Judging History

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

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

answer

#include"inv.h"
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;
}

Details

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:3:1: error: ‘unordered_map’ does not name a type
    3 | unordered_map<int,int>Inv;
      | ^~~~~~~~~~~~~
answer.code: In function ‘void init(int)’:
answer.code:6:9: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
    6 |         Inv[1]=1;
      |         ^~~
      |         inv
answer.code: In function ‘int inv(int)’:
answer.code:11:17: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
   11 |         else if(Inv[x])
      |                 ^~~
      |                 inv
answer.code:14:25: error: ‘ll’ was not declared in this scope
   14 |                 return (ll)(MOD-MOD/x)%MOD*inv(MOD%x)%MOD;
      |                         ^~