1 solutions

  • 0
    @ 2022-8-16 20:47:18
    #include <bits/stdc++.h>
    using namespace std;
    #define accelerate ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
    #define int unsigned long long
    #define mod 1000000007
    #define ll unsigned long long
    #define PII pair<int,int>
    #define INF 0x3f3f3f3f
    const int N=1e4+10;
    const int base=53;
    int n,m,k,x,y,T,xx,yy;
    int hashh[N];
    char a[N];
    set<int>s;
    signed main(){
    	accelerate;
    	cin>>T;
    	while(T--){
    		cin>>a+1;
    		int len=strlen(a+1);
    		for(int i=1;i<=len;i++){
    			hashh[i]=hashh[i-1]*base+(a[i]-'0'+1);
    		}
    		s.insert(hashh[len]);
    	}
    	cout<<s.size();
    	return 0;
    } 
    
    • 1

    Information

    ID
    6521
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    9
    Tags
    (None)
    # Submissions
    16
    Accepted
    4
    Uploaded By