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;
        }
}
目录
相关文章
Uva10001 Garden of Eden
Uva10001 Garden of Eden
46 0
uva10038 Jolly Jumpers
uva10038 Jolly Jumpers
37 0
uva 10340 all in all
输入两个字符串s和t,判断是否可以从t中删除0个或多个字符(其他字符顺序不变),得到字符串是。
37 0
UVa11968 - In The Airport
UVa11968 - In The Airport
55 0
UVa10123 No Tipping
UVa10123 No Tipping
61 0
uva10112 Myacm Triangles
uva10112 Myacm Triangles
42 0
UVa11776 - Oh Your Royal Greediness!
UVa11776 - Oh Your Royal Greediness!
51 0
uva375 Inscribed Circles and Isosceles Triangles
uva375 Inscribed Circles and Isosceles Triangles
39 0
uva127 "Accordian" Patience
uva127 "Accordian" Patience
42 0
UVa11876 - N + NOD (N)
UVa11876 - N + NOD (N)
63 0