Cod sursa(job #3363428)

Utilizator alexm749Musat Alexandru Nicolae alexm749 Data 17 august 2026 23:03:06
Problema Restante Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.82 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<n-1; i++)
    {
        if(!V[i])
        {
            for(int j=i+1; j<n; j++)
            {
                if(!V[j])
                {
                    if(strcmp(s[i],s[j])==0)
                    {
                        V[i]=1;
                        V[j]=1;
                    }
                }
            }
            if(!V[i])nr++;
        }
    }
    if(!V[n-1])nr++;
    g<<nr;
    return 0;
}