74为什么是FE?

wyh15 2024-04-07 20:47:20 2024-04-08 18:59:20 11
#include<bits/stdc++.h> 

using namespace std; 

struct j{ 

	int hao; 

	int m; 

	char g[100001]; 

}f[5005];

bool cmp(j a,j b){ 

	if(a.m!=b.m) return a.m>b.m; 

	else{ 

		for(int i=1;i<=a.m;i++){ 

			if(a.g[i]!=b.g[i]){ 

				return a.g[i]>b.g[i]; 

				break; 

			} 

		} 

	}
 
}

int main(){
 
	freopen("president.in", "r", stdin);

	freopen("president.out", "r", stdout);

	int a; 

	cin>>a;

	for(int i=1;i<=a;i++){ 

		f[i].hao=i; 

		cin>>f[i].g; 

		f[i].m=strlen(f[i].g); 

	} 

	sort(f+1,f+a+1,cmp); 

	cout<<f[1].hao<<" "; 

	for(int i=0;i<f[1].m;i++) cout<<f[1].g[i];

	fclose(stdin);

	fclose(stdout);

	return 0; 

}

{{ vote && vote.total.up }}

共 1 条回复

root 站长

FE是文件错误,你需要在代码中加入文件操作。