题目:给了slury的语法(由slimp和slump组成),语法分析判断
注意:函数变量用形参
函数设置一个begin变量真的很方便
#include <cstdio>
#include <string.h>
#include <cstdlib>
#include <cmath>
#include <ctgmath>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool slump(char m[61],int &begin){
if(m[begin]=='D' || m[begin]=='E'){
if (m[++begin] == 'F') {
while (m[++begin]=='F');
if(m[begin]=='G') return true;
else if(m[begin]=='D' || m[begin]=='E') return slump(m, begin);
else return false;
}
else return false;
}
else return false;
}
//DFG
// 01234567
//DFG, EFG, DFFFFFG, DFDFDFDFG, DFEFFFFFG
//DFEFF, EFAHG, DEFG, DG, EFFFFDG
bool slimp(char m[61]