Cod sursa(job #3363426)

Utilizator alexm749Musat Alexandru Nicolae alexm749 Data 17 august 2026 22:57:29
Problema Restante Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.77 kb
#include <iostream>
#include <fstream>
#include <cstring>
#include <algorithm>

using namespace std;

ifstream f("restante.in");

ofstream g("restante.out");

int nr;
bool V[36000];
int main()
{
    int n;
    char s[36000][17];
    f>>n;
    f.get();
    for(int i=0; i<n; i++)
    {
        f.getline(s[i],17);
        sort(s[i],s[i]+strlen(s[i]));
    }
    for(int i=0; i<=35999; i++)V[i]=1;
    for(int i=0; i<n-1; i++)
    {
        if(V[i])
        {
            for(int j=i+1; j<n; j++)
            {
                if(strcmp(s[i],s[j])==0)
                {
                    V[i]=0;
                    V[j]=0;
                }
            }
            if(V[i])nr++;
        }
    }
    if(V[n-1])nr++;
    g<<nr;
    return 0;
}