Cod sursa(job #170154)

Utilizator gabor_oliviu1991gaboru corupt gabor_oliviu1991 Data 2 aprilie 2008 14:11:30
Problema Restante Scor 50
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream.h>



int sort_function( const void *a, const void *b);

char list[1000][17];

int main()
{
   ifstream f("restante.in");
   ofstream g("restante.out");

   unsigned int  x,n,k,y;
   f>>n;f.get();k=n;
   for(x = 0; x < n; x++)
	{ f.get(list[x],17);
	  qsort((void *)list[x], strlen(list[x]), sizeof(list[x][0]), sort_function);
	  f.get();
	}
   qsort((void *)list, n, sizeof(list[0]), sort_function);


   x=0;y=n;
   do{
	k=1;
	while(strcmp(list[x],list[x+1])==0)	{ k++;x++;}
	if(k>1)	y-=k;
	else	x++;
     }
   while(x<n);
   g<<y;


   return 0;
}

int sort_function( const void *a, const void *b)
{
   return( strcmp((char *)a,(char *)b) );
}