为啥自己电脑和IDE上都能运行,然而交上去报错啊QAQ
查看原帖
为啥自己电脑和IDE上都能运行,然而交上去报错啊QAQ
300541
孤星夜雨楼主2020/5/24 18:48
#include<iostream>
#include<cstring>
using namespace std;
char qiujiu[1005][1005];
int changdu[1005];
char mingzi[1005][1005];
int main(){
	freopen("save.in", "r", stdin);  
	freopen("save.out", "w", stdout);
	int renshu;
	int jishu[1005];
	cin>>renshu;
	for(int i=1;i<=renshu;i++){
    	scanf("%s",mingzi[i]);
		scanf("%s",qiujiu[i]);
    	changdu[i]=strlen(qiujiu[i]);
    	jishu[i]=0;
	}
	
	for(int m=1;m<=renshu;m++){
		for(int n=0;n<=changdu[m];n++){
			if(qiujiu[m][n]=='s'&&qiujiu[m][n+1]=='o'&&qiujiu[m][n+2]=='s'){
			jishu[m]+=1;
			}
		}
	}

	int zuida=0;
	for(int o=1;o<=renshu;o++){
		if(jishu[o]>zuida){
			zuida=jishu[o];
		}
	}
	
	int zuizhong[1000];
	int qaq=0;
	for(int o=1;o<=renshu;o++){
		if(jishu[o]==zuida){
			qaq+=1;
			zuizhong[qaq]=o;
		}
	}
	
	for(int y=1;y<qaq;y++){
		cout<<mingzi[zuizhong[y]]<<" ";
	}
	cout<<mingzi[zuizhong[qaq]]<<endl<<zuida;
	return 0;		
}
2020/5/24 18:48
加载中...