QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#850088#5. 在线 O(1) 逆元mnbvcxz123Compile Error//C++23447b2025-01-09 20:15:332025-01-09 20:15:34

Judging History

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

  • [2025-01-09 20:15:34]
  • 评测
  • [2025-01-09 20:15:33]
  • 提交

answer

#include"inv.h"
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

constexpr int mod=998244353;

int xd(int a) {
  return a <= 1 ? a : m - (long long)(m/a) * xd(m % a) % m;
}

ll inver[100000000];

int lst=1;

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

int inv(int x){
    return xd(x);
    while(lst<x){
        inver[lst]=mod-(long long)(mod/lst)*inver[mod%lst]%mod;
        ++lst;
    }
    return inver[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);
      |         ~~~~~^~~~~~~~~~
answer.code: In function ‘int xd(int)’:
answer.code:9:23: error: ‘m’ was not declared in this scope
    9 |   return a <= 1 ? a : m - (long long)(m/a) * xd(m % a) % m;
      |                       ^