蒟蒻问一个小问题,在代码注释里面QAQ
查看原帖
蒟蒻问一个小问题,在代码注释里面QAQ
393190
aldol_reaction楼主2020/11/10 20:17
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<set>
using namespace std;

#define debug(x)std::cout << "Line" << __LINE__ << "	" << #x << "=" << x << std::endl

string dfs(void) {
	string ans = "";
	char ch;
	while(cin >> ch) {
		if(ch == '[') {
//			int t;
//			cin >> t;
			int t = getchar() - '0';//不明白为什么把这行变成上面注释的两行就AC了; 
			string str = dfs();
			while(t--) ans += str;
		} else if(ch == ']') return ans;
		else ans += ch;
	}
	return ans;
}
int main() {
	cout << dfs();
	return 0;
}

2020/11/10 20:17
加载中...