显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
int n;
struct help
{
string name;
string hp;
int cntt=0;
bool maxt=true;
};
int main()
{
freopen("noi_online2020_save.in","r",stdin);
freopen("noi_online2020_save.out","w",stdout);
cin>>n;
help men[120];
for(int i=1;i<=n;++i)
{
cin>>men[i].name>>men[i].hp;
int x=men[i].hp.size();
for(int j=0;j<=x;++j)
{
if(men[i].hp[j]=='s'&&men[i].hp[j+1]=='o'&&men[i].hp[j+2]=='s')
{
men[i].cntt=men[i].cntt+1;
}
}
}
for(int i=1;i<=n;++i)
{
for(int j=1;j<=n;++j)
{
if(men[i].cntt<men[j].cntt)
{
men[i].maxt=false;
}
}
}
for(int i=1;i<=n;++i)
{
if(men[i].maxt==true)
cout<<men[i].name<<" ";
}
cout<<endl;
for(int i=1;i<=n;++i)
{
if(men[i].maxt==true)
{
cout<<men[i].cntt;
break;
}
}
return 0;
}