Cod sursa(job #1555160)
| Utilizator | Data | 22 decembrie 2015 13:08:31 | |
|---|---|---|---|
| Problema | Restante | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include<fstream>
#include<string.h>
#include<map>
using namespace std;
ifstream cin("restante.in");
ofstream cout("restante.out");
map<long long, bool> H;
short viz[30];
string a;
int n;
int rs;
unsigned long h;
int main()
{
cin>>n;
for(int i=1; i<=n; ++i)
{
cin>>a;
for(int j=0; j<27; ++j)
viz[j]=0;
for(int k=0; k<a.size(); ++k)
viz[a[k]-'a']++;
h = 5381;
for(int j=0; j<27; ++j)
h = ((h << 5) + h) + viz[j];
if(!H[h])
rs++, H[h]=true;
}
cout<<rs;
}
