面试

解题思路
每次输入4个字符,判断一下即可
code
#include<iostream>
#include<cstdio>
using namespace std;
int T;
int main()
{
cin>>T;
while(T--)
{
int s[5]={};
for(int i=1;i<=4;i++)
{
char a;
cin>>a;
s[a-'A'+1]++;
}
if(s[4]>0||s[3]>1)
{
cout<<"failed"<<endl;
continue;
}
if(s[1]>2)
{
cout<<"sp offer"<<endl;
continue;
}
cout<<"offer"<<endl;
}
}
本文介绍了一道面试题目,要求实现一个简单的字符串判断逻辑。通过输入四个字符并进行特定条件下的判断,来决定输出“offer”、“spoffer”还是“failed”。该题目主要考察了基本的输入输出操作及条件判断能力。
4135

被折叠的 条评论
为什么被折叠?



