抱灵need help
查看原帖
抱灵need help
1367086
zzhhyy1234楼主2024/8/22 10:07

44 省选错误 ++ 66 NOI错误

mycodemy code:

#include<bits/stdc++.h>
using namespace std;

string s;
int find(int i){
	stack<bool> a;
	a.push(0);
	while(i++){
		if(s[i]=='[') a.push(0);
		else if(s[i]==']') a.pop();
		if(a.empty()) return i;
	}
}
int dfs(int h,int t)
{
	if(isdigit(s[h])){
		for(int j=1;j<=s[h]-'0';j++)
			for(int i=h+1;i<=t-1;i++){
				if(s[i]!='[') cout<<s[i];
				else{
					dfs(i+1,find(i));
					i=find(i)+1;
				}
			}
	}
	else{
		for(int i=h;i<=t;i++){
			if(s[i]!='[') cout<<s[i];
			else{
				dfs(i+1,find(i));
				i=find(i)+1;
			}
		}
	}
}
int main()
{
	cin>>s;
	dfs(0,s.length()-1);
	return 0;
} 

过了样例

自测输入

[4CB]

输出

CB]           x<z             P     X]  CB            y=z         P     inGW64\by=z   `     P             y=z          P           y=z            P             y=z          P     \System3=|         鸨                                  y=z               P     DOWS;C:\e=f                                                                                       XCB            y=z            P     inGW64\by=z   `     P             y=z          P           y=z            P             y=z        鸨                                  y=z               P     DOWS;C:\e=f                                                                                       XCB            y=z            P     inGW64\by=z   `     P             y=z          P           y=z            P             y=z        鸨                                  y=z               P     DOWS;C:\e=f                                                                                       XCB            y=z            P     inGW64\by=z   `     P             y=z          P           y=z            P             y=z        鸨                                  y=z               P     DOWS;C:\e=f                                                                                       X                                                                                                                                                                                                                                                                                                                                                                            y=z             P     rogramDay=z          P     mFiles=Cj=i               iles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\WINDOWy=z         P     ppData\Ly=z            P     enovo\Apo<m    P兟     P             P兟                   衆     P         X]       `吢     P     衆     `吢     rs\lenovo windir=C:\WINDOWS WXDRIVE_STAR

         P兟     P     =0 --disable-gpu --disable-software-rasterizer --enable-features=NetworkServiceInProcess ZWCADPATH=D:\360downloads\软件安装\ZWCAD.EXE   ?

人间迷惑,我好像泄露了某些信息

2024/8/22 10:07
加载中...