本题有错???
  • 板块P1928 外星密码
  • 楼主_ryan
  • 当前回复12
  • 已保存回复12
  • 发布时间2024/10/16 13:10
  • 上次更新2024/10/16 16:53:43
查看原帖
本题有错???
1316630
_ryan楼主2024/10/16 13:10

这道题我的代码明明和题解1的基本一样,可全是RE,我又试了一下题解1的,也是RE,为啥???

#include<bits/stdc++.h>
using namespace std;
string read()
{
	char c;
	int num;
	string x,s;
	while(cin>>c)
	{
		if(c=='[')
		{
			scanf("%d",&num);
			s=read();
			for(int i=1;i<=num;++i) x+=s;
		}
		else if(c==']') return x;
		else x+=c;
	}
	for(int i=0;i<x.size();++i) cout<<x[i];
}
int main()
{
	read();
	return 0;
}
2024/10/16 13:10
加载中...