P1928有问题,求大佬帮助!!
  • 板块题目总版
  • 楼主赵德铭
  • 当前回复1
  • 已保存回复1
  • 发布时间2020/10/14 18:14
  • 上次更新2023/11/5 10:47:01
查看原帖
P1928有问题,求大佬帮助!!
95641
赵德铭楼主2020/10/14 18:14

本蒟蒻很菜,只有四十分

#include<bits/stdc++.h>
#define int long long
using namespace std;
string a;
int y,o;
bool b[1000005];
string f(int u){
	int n;
	string s="",ss;
	for(int i=u;i<y;i++){
		if(b[i]==1)continue;
		b[i]=1;
		o=max(o,i);
		if(a[i]>='0'&&a[i]<='9')continue;
		if(a[i]==']')return s;
		if(a[i]=='['){
			i++;
			while(a[i]>='0'&&a[i]<='9'){
				b[i]=1;
				n=n*10+a[i]-'0';
				i++;
			}
			ss=f(i);
			while(n--)s+=ss;
		}
		else{
		    s+=a[i];
		}
	}
}
signed main(){
	cin>>a;
	y=a.size();
	cout<<f(0);
	while(o!=y-1){
		cout<<f(o+1);
	}
}
2020/10/14 18:14
加载中...