数据太弱
查看原帖
数据太弱
817704
Inferior_dust楼主2023/7/27 11:03

用完哈希后我试了一下这个...AC了

#include <bits/stdc++.h>
using namespace std ;

int n ;
int ans = 0 ;

string a[1000000] ;
int s[1000000] ;

int main ( )
{
	ios::sync_with_stdio ( 0 ) ;
	cin >> n ;
	
	for ( int i = 1 ; i <= n ; i ++ ) {
		cin >> a[i] ;
		
	}
	sort ( a + 1 , a + 1 + n ) ;
	for ( int i = 1 ; i <= n ; i ++ ) {
		if ( a[i] != a[i + 1] ) {
			ans ++ ;
		}
	}
	cout << ans << endl ;
	return 0 ;
}
2023/7/27 11:03
加载中...