字符串套 递归
#include<bits/stdc++.h> using namespace std; char s[1005]; int n,i; string work(){ string p; int t = 0; while(++i <= n){ if(s[i] >= '0' && s[i] <= '9'){ t = s[i] - '0'; } else if(s[i] == '('){ string pp = work(); while(t--) p += pp; t = 0; } else if(s[i] == ')') return p; else p += s[i]; } return p; } int main(){ cin>>s+1; n = strlen(s+1); cout<<work(); return 0; }
zgy:
rty
标签:2928,string,contest,int,1709,problem From: https://www.cnblogs.com/caterpillor/p/17635809.html