最辣の鸡 @ 2021-03-13 10:13:54
g++: 编译器内部错误:文件大小超出限制 signal terminated program cc1plus 请提交一份完整的错误报告, 如有可能请附上经预处理后的源文件。 参阅 file:///usr/share/doc/gcc-8/README.Bugs 以获取指示。
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
const int mod = 9901;
struct jiegouti {
bool ifprime = true;
int pow = 0;
}num[50000010];
int a, b;
bool isprime(ll x) {
for (int i = 2; i <= sqrt(x); ++i) {
if (x % i == 0) return false;
}
return true;
}
void Eratos(int a) {
for (int i = 2; i <= a; ++i) {
if (isprime(i)) {
for (int j = 2; j * i <= a; ++j) {
//ifprime[j * i] = 0;
num[j * i].ifprime = false;
}
}
}
}
int main()
{
cin >> a >> b;
int temp_a = a;
Eratos(a);
for (int i = 2; i <= a; ++i) {
if (num[i].ifprime) {
while (temp_a % i == 0) {
temp_a /= i;
num[i].pow++;
}
}
if (temp_a == 0) break;
}
for (int i = 2; i <= a and num[i].ifprime; ++i) {
num[i].pow *= b;
}
int ans = 1;
int temp_sum = 0;
for (int i = 2; i <= a and num[i].ifprime; ++i) {
temp_sum = (pow(i, num[i].pow + 1) - 1) / (i - 1);
ans *= temp_sum % mod;
temp_sum = 0;
ans %= mod;
}
cout << ans;
return 0;
}
by 鏡音リン @ 2021-03-13 10:16:19
@最辣の鸡 数组开太大了
by ieeqwq @ 2021-03-13 10:22:53
50000010,你太大了
by ieeqwq @ 2021-03-13 10:22:59
@最辣の鸡
by 最辣の鸡 @ 2021-03-13 10:25:53
dbq这就改