QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#241452#5. 在线 O(1) 逆元mfeitveerCompile Error//C++14373b2023-11-06 07:51:282024-11-05 21:54:24

Judging History

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

  • [2024-11-05 21:54:24]
  • 管理员手动重测本题所有提交记录
  • [2023-11-06 07:51:30]
  • 评测
  • [2023-11-06 07:51:28]
  • 提交

answer

#include "inv.h"
#include <map>
using namespace std;

const int N = 10000010;
const int mod = 998244353;

typedef long long ll;

unordered_map<int, int> mp;

ll Inv[N];

ll ask(ll x)
{
    if(mp.find(x)) return mp[x];
    return mp[x] = (mod - mod / x) * ask(mod % x) % mod;
}

void init(int p)
{
	mp[1] = 1;
}

int inv(int x)
{
	return ask(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:10:1: error: ‘unordered_map’ does not name a type
   10 | unordered_map<int, int> mp;
      | ^~~~~~~~~~~~~
answer.code: In function ‘ll ask(ll)’:
answer.code:16:8: error: ‘mp’ was not declared in this scope
   16 |     if(mp.find(x)) return mp[x];
      |        ^~
answer.code:17:12: error: ‘mp’ was not declared in this scope
   17 |     return mp[x] = (mod - mod / x) * ask(mod % x) % mod;
      |            ^~
answer.code: In function ‘void init(int)’:
answer.code:22:9: error: ‘mp’ was not declared in this scope; did you mean ‘p’?
   22 |         mp[1] = 1;
      |         ^~
      |         p