求一个能卡住我程序的数据,谢谢各位大佬了
  • 板块P1928 外星密码
  • 楼主拱垲
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/10/14 21:09
  • 上次更新2023/11/2 13:47:28
查看原帖
求一个能卡住我程序的数据,谢谢各位大佬了
139334
拱垲楼主2023/10/14 21:09

我知道错在哪里,但是只有40分。次数满了下载不了数据。

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
using namespace std;
string s;

void kopen()
{
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='[')
		{
			int r,f=0;
			for(int j=i+1;j<s.length();j++)
			{
				if(s[j]=='[')f++;
				if(s[j]==']')
				{
					f--;
				}
				if(f==-1)
				{
					r=j;
					break;
				}
			}
			cout<<i<<' '<<r<<' ';
			s.erase(r,1);
			int tt=s[i+1]-'0';
			s.erase(i,2);
			string t=s.substr(i,r-i-2);
			for(int k=1;k<tt;k++)
				s.insert(i,t);	
			cout<<t<<endl;
			cout<<s<<endl;
			getchar();
			kopen();
			return;
		}
	}
}

int main()
{
	cin>>s;
	kopen();
	cout<<s;
    return 0;
}
2023/10/14 21:09
加载中...