https://pintia.cn/problem-sets/994805260223102976/problems/994805273883951104
测试点0:Are you kidding me? @/@中“\”为转义字符 要用双\表示
测试点1:最后一个表情是下界溢出
测试点2:中间有表情下界溢出
#include <iostream>
using namespace std;
int f(string a[], string s){
int cnt = 0;
for(int i = 0; i < s.size(); i++){
while(s[i] == '['){
string tmp = "";
cnt++, ++i;
while(s[i] != ']')
tmp += s[i++];
a[cnt] = tmp;
break;
}
}
return cnt;
}
int main(){
string hand, eye, mouth, h[15], e[11], m[11];
int n, cnth = 0, cnte = 0, cntm = 0;
getline(cin, hand); getline(cin, eye); getline(cin, mouth);
cnth = f(h, hand); cnte = f(e, eye); cntm = f(m, mouth);
cin >> n;
for(int i = 0; i < n; i++){
int n1, n2, n3, n4, n5;
cin >> n1 >> n2 >> n3 >> n4 >> n5;
if(n1 <= 0 || n2 <= 0 || n3 <= 0 || n4 <= 0 || n5 <= 0){
cout << "Are you kidding me? @\\/@" << endl;
continue;
}
if(n1 <= cnth && n5 <= cnth && n2 <= cnte && n4 <= cnte && n3 <= cntm)
cout << h[n1] << "(" << e[n2] << m[n3] << e[n4] << ")" << h[n5] << endl;
else
cout << "Are you kidding me? @\\/@" << endl;
}
return 0;
}