BNUOJ-51635 Check In From 网络同步赛 A
题目链接
题意:寻找参赛列表中本校(即学校英文名缩写是”bnu”的队伍)队伍的数量。WA是因为格式为”学校英文名缩写16-队伍编号”的字符串,我只检验“bnu”这个字符串,应该是“bnu16-”
#include"iostream"
#include"cstring"
#include"cstdio"
using namespace std;
int main(){
char s[150],ss[7]="bnu16-";
int i,j,t,n,count,flag;
cin>>t;
while(t--){
cin>>n;
count = 0;
for(i=0; i<n; i++){
cin>>s;
flag = 0;
for(j=0; j<6 && !flag ; j++){
if(s[j] != ss[j] ){
flag = 1;
}
}
if(!flag) //前缀相同
count++;
}
cout<<count<<endl;
}
return 0;
}