40分求助
  • 板块P1928 外星密码
  • 楼主Kino666
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/14 14:00
  • 上次更新2024/12/14 16:44:48
查看原帖
40分求助
1496051
Kino666楼主2024/12/14 14:00
#include<bits/stdc++.h>
using namespace std;
string y;
int x=0;
string f()
{
	string a="",b="";
	char c;
	int d=0;
	while(x<=y.size())
	{
		c=y[x];
		x++;
		if(c=='[')
		{
			d=y[x]-48;
			x++;
			a=f();
			while(d--)
			{
				b=b+a;
			}
		}
		else if(c==']')
		{
			return b;
		}
		else b=b+c;
	}
}
int main()
{
	cin>>y;
	cout<<f();
	return 0;
}
2024/12/14 14:00
加载中...