VMSORT - Sắp xếp

Tác giả: skyvn97

Ngôn ngữ: C++

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char name[1011][30];
char tmp[30];
char part[30];
bool check;
int k,n,i,j,l,t;
int count;
int main(void)
{
    count=0;
    gets(tmp);    
    k=atoi(tmp);    
    for (i=1;i<=k;i=i+1)
        {
         gets(tmp);
         n=atoi(tmp);
         for (j=1;j<=n;j=j+1)
             {
              gets(part);
              check=true;
              for (l=1;l<=count;l=l+1)                  
                  if (strcmp(part,name[l])==0)
                     {
                      check=false;
                      break;
                     }
              if (check)
                 {
                  count=count+1;
                  for (t=0;t<=strlen(part);t=t+1) name[count][t]=part[t];
                 }
             }
        }
    printf("%d",count);
}

Download