为啥我交代码第一遍全AC,第二遍全RE
查看原帖
为啥我交代码第一遍全AC,第二遍全RE
705879
him0715楼主2025/8/30 21:24
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	string s[m][n];
	for(int i=0;i<m;i++)
	    for(int j=0;j<n;j++)
	        cin>>s[i][j];
	for(int i=0;i<n;i++){
		bool tmp=true;
		string stmp=s[0][i];
		for(int j=0;j<m;j++){
			if(s[j][i]!=stmp){tmp=false;break;}
		}
		if(tmp){
            if(i==n-1)cout<<stmp;
            else cout<<stmp<<" ";
        }
		else{
            if(i==n-1)cout<<"*";
            else cout<<"* ";
        }
	}
	cout<<endl;
	return 0;
}

是谷的问题还是代码

2025/8/30 21:24
加载中...