Dev-c++上编译成功的为什么提交上去就编译失败了???
查看原帖
Dev-c++上编译成功的为什么提交上去就编译失败了???
1472213
wangkaibo123楼主2025/7/23 09:18
#include<bits/stdc++.h>
#include<cstring>
using namespace std;
struct dc{
	string c;
	int cp;
}a[105];
char s[50];
int n,f=1;
bool t;
bool cmp(dc x,dc y){
	return x.cp>y.cp;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s;
		strlwr(s);
		t=true;
		for(int j=1;j<=f;j++){
			if(s==a[j].c){
				a[j].cp++;
				t=false;
			}
		}
		if(t){
			a[f].c=s;
			a[f].cp=1;
			f++;
		}
	}
	sort(a+1,a+1+n,cmp);
	cout<<a[1].c;
	return 0;
}
2025/7/23 09:18
加载中...