为什么60
查看原帖
为什么60
157598
Magallan_forever楼主2020/5/24 22:00
#include<cstdio>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
string s;
struct node{
	int num;
	string name;
}a[101];
bool cmp(const node& a,const node& b){
	return a.num>b.num; 
}
int main(){
	freopen("save.in","r",stdin),freopen("save.out","w",stdout);
	int n,ans;
	scanf("%d",&n);
	for(int i=0;i<n;++i){
		cin>>a[i].name>>s;
		for(int j=2;j<s.length();++j) a[i].num+=(s[j-2]=='s'&&s[j-1]=='o'&&s[j]=='s');
	}
	sort(a,a+n,cmp),ans=a[0].num;
	for(int i=0;!(ans^a[i].num);++i) cout<<a[i].name<<" ";
	printf("\n%d",ans);
	return 0;
}

回家一测,直接雷击

2020/5/24 22:00
加载中...