题目还是考细节,有两次评C,字符串中C的个数应该大于等于2;四轮中有一次发挥被评为 D,说明字符串中D的个数大于1。
思路:用一个数组标记一下,再模拟题目就可以了
#include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d",&n); getchar(); while(n--) { char s[5]; int bo[5]= {0}; scanf("%s",s); for(int i=0; i<4; ++i) bo[s[i]-'A']++; if(bo[3]||bo[2]>=2) puts("failed"); else if(bo[3]==0&&bo[0]>=3) puts("sp offer"); else puts("offer"); } return 0; }