为什么运行出错
  • 板块灌水区
  • 楼主yinqf
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/12/17 12:34
  • 上次更新2023/10/24 07:27:44
查看原帖
为什么运行出错
673730
yinqf楼主2022/12/17 12:34

洛谷IDE:

#include<bits/stdc++.h>
using namespace std;
string s,ans; 
string chu(string c){
	int shu=0;
	string z="",r="",sh="";
	for(int i=1;i<c.size();i++){
		if(c[i]>='0'&&c[i]<='9'){
			sh+=c[i];
		}
		else if(c[i]=='['){
			while(c[i]!=']'){
				r+=c[i];
                i++;
			}
			z+=chu(r);
		}
		else if(c[i]!=']'){
			z+=c[i];
		}
	}
	ans=ans+sh;
	ans=ans+z;
	//for(int i=1;i<=shu;i++){
	//	ans+=z;
	//}
}
int main(){
	ios::sync_with_stdio(false);
	cin >> s;
	s="[1"+s+"]";
	chu(s);
	cout << ans;
	return 0;
}

2022/12/17 12:34
加载中...