Cod sursa(job #1239619)
| Utilizator | Data | 9 octombrie 2014 14:00:25 | |
|---|---|---|---|
| Problema | Restante | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include<fstream>
#include<algorithm>
#include<cstring>
using namespace std;
int i, j, n, sol, p[36003];
char ch[36003][18], aux[18];
ifstream in("restante.in");
ofstream out("restante.out");
int cmp(int i, int j) {
return strcmp(ch[i], ch[j])< 0;
}
int main(){
in>>n;
for(i=1; i<=n; i++){
in>>ch[i];
sort(ch[i], ch[i]+strlen(ch[i]));
p[i] = i;
}
sort(p+1, p+n+1, cmp);
for(i=1; i<=n; i++){
if(strcmp(ch[p[i]], ch[p[i+1]])!=0)
sol++;
}
out<<sol;
return 0;
}
