问一下各位大佬,这个思路有什么问题吗,为什么只通过了50%
查看原帖
问一下各位大佬,这个思路有什么问题吗,为什么只通过了50%
1386919
Duuuuu楼主2024/11/1 16:03
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	bool have=true;
	string poke[54]={};
	int s=1;
	for(int i=0;i<n;i++){
		string a;
		cin>>a;
		have=true;
		if(i==0) poke[0]=a; 
		else{
			for(int j=0;j<s;j++){
				if(a==poke[j]){
					have=false;
					break;
				}
			}
			if(have) s++;
		}
		
	}
	cout<<52-s;
	return 0;
} 
2024/11/1 16:03
加载中...