QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650585#5. 在线 O(1) 逆元yduckCompile Error//C++14220b2024-10-18 15:40:462024-11-05 22:06:34

Judging History

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

  • [2024-11-05 22:06:34]
  • 管理员手动重测本题所有提交记录
  • [2024-10-18 15:40:47]
  • 评测
  • [2024-10-18 15:40:46]
  • 提交

answer

#include<inv.h>

int mo;

int inv(int x){
  int res = 1, n = mo - 2;
  while(n){
    if(n & 1) res = 1ll * res * x % mo;
    x = x * x % mo;
    n >>= 1;
  }
  return res;
}

void iniv(int p){
  mo = p;
}

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:1:9: fatal error: inv.h: No such file or directory
    1 | #include<inv.h>
      |         ^~~~~~~
compilation terminated.