QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#356436#5. 在线 O(1) 逆元l3773lCompile Error//C++14778b2024-03-17 19:25:262024-11-05 21:57:48

Judging History

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

  • [2024-11-05 21:57:48]
  • 管理员手动重测本题所有提交记录
  • [2024-03-17 19:25:27]
  • 评测
  • [2024-03-17 19:25:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define For(i,a,b) for (int i = (a), i##__end = (b); i <= i##__end; ++i)
#define Ford(i,a,b) for (int i = (a), i##__end = (b); i >= i##__end; --i)
typedef long long ll;
typedef long double lf;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define fl(s) s.begin(), s.end()
// #include "inv.h" 

int mod;
const int MAXN = 1e9 + 7;
int inve[MAXN];

int mul(int x, int y) {
    return (ll)x * y % mod;
}

void init(int p) {
    mod = p;
    inve[0] = 0;
    inve[1] = 1 % mod;
    For (i, 2, p) inve[i] = mod - mul(p / i, inve[p % i]);
}

int inv(int x) {
    return inve[x];
}

// int main() {
//     init(998244353);
//     For (i, 1, mod) cout << inv(i) << endl;
// }

詳細信息

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);
      |         ~~~~~^~~~~~~~~~
/tmp/ccazZuxC.o: in function `mul(int, int)':
answer.code:(.text+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `mod' defined in .bss section in /tmp/ccazZuxC.o
/tmp/ccazZuxC.o: in function `init(int)':
answer.code:(.text+0x2d): relocation truncated to fit: R_X86_64_PC32 against symbol `mod' defined in .bss section in /tmp/ccazZuxC.o
collect2: error: ld returned 1 exit status