比赛 |
20220418高一小测验 |
评测结果 |
AAAAAAAAAA |
题目名称 |
紧急救助(民间数据) |
最终得分 |
100 |
用户昵称 |
惠惠 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2022-04-18 20:36:14 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
int n;
struct Need_save
{
string name;
int sos_num = 0;
}save[110];
struct Max
{
int num = 0, xiabiao[110] = {0}, save_num = 0;
}max1;
int main()
{
freopen("noi_online2020_save.in","r",stdin);
freopen("noi_online2020_save.out","w",stdout);
cin >> n;
for(int i = 1; i <= n; ++i)
{
char sign[100000];
cin >> save[i].name >> sign;
for(int j = 0; j <= strlen(sign); ++j)
{
if(sign[j] == 's' && sign[j + 1] == 'o' && sign[j + 2] == 's') ++save[i].sos_num;
}
}
for(int i = 1; i <= n; ++i)
{
if(save[i].sos_num > max1.num)
{
max1.num = save[i].sos_num;
max1.save_num = 1;
max1.xiabiao[max1.save_num] = i;
}
else if(save[i].sos_num == max1.num)
{
++max1.save_num;
max1.xiabiao[max1.save_num] = i;
}
}
for(int i = 1; i <= max1.save_num; ++i)
{
cout << save[max1.xiabiao[i]].name << " ";
}
cout << endl << save[max1.xiabiao[1]].sos_num << endl;
return 0;
}