uva10152 ShellSort

简介: uva10152 ShellSort
#include <stdio.h>#include <string.h>#define LOCALintt, n;
charsrc[201][90], dst[90];
intindex[201], la;
voidsearch(char*str);
intmain()
{
inti, j;
#ifdef LOCALfreopen("c://uva_in.txt", "r", stdin);
#endifscanf("%d", &t);
for (i=0; i<t; i++)
    {
scanf("%d", &n);
getchar();
la=0;
for (j=0; j<n; j++)
gets(src[j]);
for (j=0; j<n; j++)
        {
gets(dst);
search(dst);
        }
for (j=n-2; j>=0; j--)
if (index[j] >index[j+1])
break;
for (; j>=0; j--)
printf("%s/n", src[index[j]]);
printf("/n");
    }
return0;
}
voidsearch(char*str)
{
inti;
for (i=0; i<n; i++)
if (strcmp(src[i], str) ==0)
        {
index[la++] =i;
break;
        }
}
目录
相关文章
UVa10123 No Tipping
UVa10123 No Tipping
53 0
uva10112 Myacm Triangles
uva10112 Myacm Triangles
36 0
UVa11776 - Oh Your Royal Greediness!
UVa11776 - Oh Your Royal Greediness!
46 0
UVa 10082 WERTYU
UVa 10082 WERTYU
120 0
概率dp - UVA 11021 Tribles
Tribles  Problem's Link:  http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=33059   Mean:  有k个细菌,每个细菌只能存活一天,在死去之前可能会分裂出0,1,2....n-1个细菌,对应的概率为p0,p1,p2....pn-1。
817 0
|
机器学习/深度学习
|
存储 固态存储