QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#775485#5. 在线 O(1) 逆元Physics2123030 0ms0kbC++17185b2024-11-23 16:03:402024-11-23 16:03:41

Judging History

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

  • [2024-11-23 16:03:41]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-11-23 16:03:40]
  • 提交

answer

#include "inv.h"
const int N=1e8;
static int P,a[N+1];
void init(int p){
  P=p,a[0]=a[1]=1;
  for(int i=2;i<=N;i++)
    a[i]=P-1ll*(P/i)*a[P%i]%P;
}
int inv(int x){return a[x];}

Details


Pretests


Final Tests

Test #1:

score: 0
Runtime Error

Test #2:

score: 0
Runtime Error

Test #3:

score: 0
Runtime Error

Test #4:

score: 0
Runtime Error

Test #5:

score: 0
Runtime Error