Cod sursa(job #916046)
| Utilizator | Data | 15 martie 2013 19:07:02 | |
|---|---|---|---|
| Problema | Restante | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include<fstream>
#include<string>
#include<string.h>
#include<algorithm>
#define NMAX 36005
using namespace std;
ifstream f("restante.in");
ofstream g("restante.out");
int i,n,sol;
char x[20];
string s[NMAX];
int main ()
{
f>>n;
for(i=1;i<=n;++i)
{
f.get();
f.get(x,20,'\n');
sort(x,x+strlen(x));
s[i]=x;
}
sort(s+1,s+n+1);
if(s[1]!=s[2])
sol++;
for(i=2;i<n;++i)
if(s[i]!=s[i+1]&&s[i]!=s[i-1])
++sol;
if(s[n]!=s[n-1])
++sol;
g<<sol;
return 0;
}
