QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#624799#5. 在线 O(1) 逆元dww_1337Compile Error//C++14323b2024-10-09 16:38:512024-11-05 22:04:45

Judging History

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

  • [2024-11-05 22:04:45]
  • 管理员手动重测本题所有提交记录
  • [2024-10-09 16:38:53]
  • 评测
  • [2024-10-09 16:38:51]
  • 提交

answer

#include "inv.h"

const int MAXN = 1e8 + 7;
const int MOD = 998244353;
int invt[MAXN];

void init(int p)
{
	invt[1] = 1;
	for(int i = 2 ; i < MAXN ; i++) invt[i] = p - 1ll * p / i * invt[p % i] % p;
}

int inv(int x)
{
	if(x < MAXN) return invt[x]
	else return  MOD - 1ll * (MOD / x) * 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: In function ‘int inv(int)’:
answer.code:15:36: error: expected ‘;’ before ‘else’
   15 |         if(x < MAXN) return invt[x]
      |                                    ^
      |                                    ;
   16 |         else return  MOD - 1ll * (MOD / x) * inv(MOD % x) % MOD;
      |         ~~~~