QOJ.ac

QOJ

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

Judging History

你现在查看的是测评时间为 2023-11-06 07:44:05 的历史记录

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

answer

#include "inv.h"

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

ll Inv[N];

inline ll ask(ll x)
{
	 fir++;
    if(x <= 10000000) return Inv[x];
    return (mod - mod / x) * ask(mod % x) % mod;
}

inline void init(int p)
{
	Inv[1] = 1;
	fro(i, 2, 10000000)
		Inv[i] = (mod - mod / i) * Inv[mod % i] % mod;
}

inline 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:6:1: error: ‘ll’ does not name a type
    6 | ll Inv[N];
      | ^~
answer.code:8:8: error: ‘ll’ does not name a type
    8 | inline ll ask(ll x)
      |        ^~
answer.code: In function ‘void init(int)’:
answer.code:17:9: error: ‘Inv’ was not declared in this scope; did you mean ‘inv’?
   17 |         Inv[1] = 1;
      |         ^~~
      |         inv
answer.code:18:13: error: ‘i’ was not declared in this scope
   18 |         fro(i, 2, 10000000)
      |             ^
answer.code:18:9: error: ‘fro’ was not declared in this scope
   18 |         fro(i, 2, 10000000)
      |         ^~~
answer.code: In function ‘int inv(int)’:
answer.code:24:16: error: ‘ask’ was not declared in this scope
   24 |         return ask(x);
      |                ^~~