一道自己IDE能运行但错,为啥洛谷上CE?
查看原帖
一道自己IDE能运行但错,为啥洛谷上CE?
1138325
MC_dream_tsr楼主2024/9/1 14:02

不要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;
}
2024/9/1 14:02
加载中...