2020-07-29 【模板】字符串哈希

2020-08-12  本文已影响0人  JalorOo

https://www.luogu.com.cn/problem/P3370

#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
set<string> s;

long long qmi(int m, int k)
{
    int res = 1, t = m;
    while (k)
    {
        if (k&1) res = res * t;
        t = t * t;
        k >>= 1;
    }
    return res;
}


int read(){
    int x = 0,f = 1;
    char c = getchar();
    while (c<'0'||c>'9') {
        if (c=='-') {
            f = -1;
        }
        c = getchar();
    }
    while (c>='0'&&c<='9') {
        x = x*10+c-'0';
        c = getchar();
    }
    return x*f;
}


int main()
{
    int n = read();
    while(n--){
        string a;
        cin>>a;
        s.insert(a);
    }
    cout<<s.size()<<endl;
    return 0;
}
/*
5
abc
aaaa
abc
abcc
12345
============
4
*/
上一篇下一篇

猜你喜欢

热点阅读