社区讨论

为什么不开 O2 会 CE

学术版参与者 7已保存回复 9

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
9 条
当前快照
1 份
快照标识符
@m5otn3v6
此快照首次捕获于
2025/01/09 12:21
去年
此快照最后确认于
2025/11/04 11:50
4 个月前
查看原帖
真的不是标题党
然而,如果你把它们随便丢进一个比较器里:
正在比较文件 ce.c 和 AC.C
FC: 找不到差异
求大佬解答原因
附: 源代码:
CPP
// P2613
#include <cctype>
#include <cstdio>
#define MOD 19260817
using namespace std;

char str[20005];

inline int qpow(long long x, int n)
{
    long long rv = 1;
    while (n)
    {
        if (n & 1)
            rv = rv * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return rv;
}

int main()
{
    fread(str, 1, 20005, stdin);
    int x = 0, y = 0;
    char *i = str;
    while (isdigit(*i))
    {
        x = (x * 10 + ((*i) ^ 48)) % MOD;
        ++i;
    }
    while (!isdigit(*i))
        ++i;
    while (isdigit(*i))
    {
        y = (y * 10 + ((*i) ^ 48)) % MOD;
        ++i;
    }
    printf("%d", int((long long)x * qpow(y, MOD - 2) % MOD));
    return 0;
}
报错信息(无 O2):
CPP
No valid executable file was produced by the compiler
/tmp/compiler_sxl1p364/src: 在函数‘main’中:
/tmp/compiler_sxl1p364/src:37:14: 警告:格式 ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
   37 |     printf("%d", (long long)x * qpow(y, MOD - 2) % MOD);
      |             ~^
      |              |
      |              int
      |             %lld
/nix/store/p58l5qmzifl20qmjs3xfpl01f0mqlza2-binutils-2.40/bin/ld: ./ccVHKgZz.o: in function `main':
src:(.text+0x167): undefined reference to `qpow'
collect2: 错误:ld 返回 1

回复

9 条回复,欢迎继续交流。

正在加载回复...