QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#241447#5. 在线 O(1) 逆元mfeitveerCompile Error//C++14407b2023-11-06 07:45:592024-11-05 21:54:07

Judging History

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

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

answer

#include "inv.h"

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

typedef long long ll;

ll Inv[N];

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

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

inline int inv(int x)
{
	return ask(x);
}

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);
      |         ~~~~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccG4WlEC.o: in function `main':
implementer.cpp:(.text.startup+0x12b): undefined reference to `init(int)'
/usr/bin/ld: implementer.cpp:(.text.startup+0x1d0): undefined reference to `inv(int)'
collect2: error: ld returned 1 exit status