MC_dream_tsr @ 2024-09-01 14:02:24
不要AC代码如果能的话,求改,代码比较抽象
错误信息
g++: 编译器内部错误:File size limit exceeded signal terminated program as
请提交一份完整的错误报告,
如有可能请附上经预处理后的源文件。
参阅 https://gcc.gnu.org/bugs/ 以获取指示。
# include<bits/stdc++.h>
using namespace std;
const int kk = pow(2, 10);
int a[31000000] = {1}, len = 1, w;
void cf(int x) {
for(int i = 0; i < len; i++) a[i] *= x;
for(int i = 0; i < len; i++) {
a[i + 1] += a[i] / 10, a[i] %= 10;
if(a[len]) len++;
}
}
void jf() {
for(int i = len - 1; i >= 0; i--)
if(a[i] - 1 < 0) a[i] += 9, a[i - 1] -= 1;
else return;
if(a[0] == 0) w = 1;
}
int main() {
int p, mc = 0;
cin >> p;
for(int i = 1; i <= (p / 10); i++) cf(kk);
for(int i = 1; i <= (p % 10); i++) cf(2);
jf();
cout << len << endl;
if(len < 500) {
for(int i = 1; i <= 500 - len; i++) {
cout << 0;
mc++;
if(mc == 50) {
cout << endl;
mc = 0;
}
}
for(int i = w; i < len - 1; i++) {
cout << a[i];
mc++;
if(mc == 50) {
cout << endl;
mc = 0;
}
}
return 0;
}
int qwq = 500;
if(w == 1) qwq++;
for(int i = w; i < qwq; i++) {
cout << a[i];
mc++;
if(mc == 50) {
cout << endl;
mc = 0;
}
}
return 0;
}
by jntmhh @ 2024-09-01 14:05:31
还是坠母大蛇
by EricWan @ 2024-09-01 14:22:24
a[31000000] = {1}
太大了,把初始化放主函数里。
by MC_dream_tsr @ 2024-09-01 17:30:21
@EricWan OK,没CE,可变成了4tle,其它wa,大佬有时间帮忙看下吗?
# include<bits/stdc++.h>
using namespace std;
const int kk = pow(2, 20);
int a[1500000], len = 1, w, mc, ans;
void cf(int x) {
for(int i = 0; i < len; i++) a[i] *= x;
for(int i = 0; i < len; i++) {
a[i + 1] += a[i] / 10, a[i] %= 10;
if(a[len]) len++;
}
}
void jf() {
for(int i = len - 1; i >= 0; i--) {
if(a[i] - 1 < 0) a[i] += 9, a[i - 1] -= 1;
else {
a[i] -= 1;
return;
}
}
}
void dream();
void cou();
int main() {
a[0] = 1;
int p;
cin >> p;
for(int i = 1; i <= (p / 20); i++) cf(kk);
for(int i = 1; i <= (p % 20); i++) cf(2);
jf();
cou();
return 0;
}
void dream() {
mc++;
if(mc == 50) {
cout << endl;
mc = 0;
}
}
void cou() {
cout << len << endl;
for(int i = 1; i <= (500 - len); i++) {
cout << 0;
ans++;
dream();
}
for(int i = 0; i <= len - 1; i++) {
cout << a[i];
dream();
ans++;
if(ans == 500) return;
}
}