社区讨论
抱灵need help
P1928外星密码参与者 2已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @m04n7wlf
- 此快照首次捕获于
- 2024/08/22 10:07 2 年前
- 此快照最后确认于
- 2025/11/04 22:47 4 个月前
:
CPP#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;
}
过了样例
自测输入
CPP[4CB]
输出
CPPCB] 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 ?
人间迷惑,我好像泄露了某些信息
回复
共 3 条回复,欢迎继续交流。
正在加载回复...