输出0!!! 求条
查看原帖
输出0!!! 求条
1285026
yupeishan2012楼主2024/10/2 18:30
#include <bits/stdc++.h>
using namespace std;

string a;
int n;
int cnt;
int c[10010];

int hash(string k){
	int t = 0;
	for(int i = 0; i < k.size(); i++){
		t += k[i] % 5 * 56 % 4 & 5;
	}
	return t;
}

int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a;
		c[i] = hash(a);
	}
	sort(c + 1,c + n + 1);
	for(int i = 1; i < n; i++){
		if(c[i] != c[i + 1]) cnt ++;
	}
	cout << cnt;
	return 0;
}
2024/10/2 18:30
加载中...