QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#609961#5. 在线 O(1) 逆元YyyyazsCompile Error//C++14393b2024-10-04 14:34:562024-11-05 22:04:24

Judging History

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

  • [2024-11-05 22:04:24]
  • 管理员手动重测本题所有提交记录
  • [2024-10-04 14:35:10]
  • 评测
  • [2024-10-04 14:34:56]
  • 提交

answer

#include "inv.h"
#include <bits/stdc++.h>

using namespace std;
using u64 = long long;

using u32 = int;

constexpr u32 mul(u32 a,u32 b){
    return u64(a)*b%998244353;
}
constexpr u32 qpw(u32 a,u32 b,u32 r=1){
    for(;b;b>>=1,a=mul(a,a)){
        if(b&1){
            r=mul(r,a);
        }
    }
    return r;
}
constexpr u32 inv(u32 x){
    return qpw(a,998244351);
}

详细

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:20:15: error: redeclaration ‘constexpr u32 inv(u32)’ differs in ‘constexpr’ from previous declaration
   20 | constexpr u32 inv(u32 x){
      |               ^~~
In file included from answer.code:1:
inv.h:2:5: note: previous declaration ‘int inv(int)’
    2 | int inv(int n);
      |     ^~~
answer.code: In function ‘constexpr u32 inv(u32)’:
answer.code:21:16: error: ‘a’ was not declared in this scope
   21 |     return qpw(a,998244351);
      |                ^