为什么编译不起
查看原帖
为什么编译不起
1245542
like_1999楼主2024/7/3 14:17
#include<bits/stdc++.h>
using namespace std;
int n = 0 , b = 0 , x = 0 , z = 0 , j = 0 , h = 0 , f = 0 , g[20000];
string m , l[1000] = "";
void cout_1(int f) {
	if (h == f) return;
	for (int q = 0 ; q < g[f] ; q++) {
		cout << l[f];
		cout_1(f + 1);
	}
} 
int main() {	
	cin >> m;
	for (int q = 0 ; q < m.size() ; q++) {
		if (m[q] == '[') {
			n++;
			b = q + 1;
			x = 1;
			h = 0;
			f = 0;
			while (n != 0) {
				j = 0;
				if (m[b] >= '0' && m[b] <= '9') {
					while (m[b] >= '0' && m[b] <= '9') {
						j = j * 10 + (m[b] - '0');
						b++;				
					}	
					x *= j;
					if (m[b] >= 'A' && m[b] <= 'Z') {
						g[h] = x;
						
						x = 1;
					}
				}
				if (m[b] >= 'A' && m[b] <= 'Z') {
					if (m[b - 1] >= '0' && m[b - 1] <= '9') h++;
					l[h - 1] += m[b]; 
				}
				if (m[b] == ']') {
					n--;
				}
				if (m[b] == '[') {
					n++;
				}
				b++;
			}
			cout_1(f);
			q = b - 1;
		}
		else {
			cout << m[q];
		}
	}
	return 0;
} 
2024/7/3 14:17
加载中...