60pts求调
  • 板块P1928 外星密码
  • 楼主yyjw14
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/9/23 23:27
  • 上次更新2023/11/2 18:24:51
查看原帖
60pts求调
916380
yyjw14楼主2023/9/23 23:27
#include<bits/stdc++.h>
using namespace std;
int i,j,k;

char ch;
string s;
bool op=0;
string ans;
string dfs()
{
    string ss;
	while(cin>>ch)
    {
        if(isupper(ch))
        {
            ss+=ch;
            
        }
        else if(ch=='[')
        {
            op=1;
			cin>>k;
            string sub=dfs();
            for(i=1;i<=k;i++)
            {
                ss+=sub;
            }
        }
        else if(ch==']')
        {
            return ss;
        }
    }
    return ss;
}
int main()
{
    
   
    ans=dfs();
    cout<<ans;
}
2023/9/23 23:27
加载中...