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;
        }
}
目录
相关文章
uva10038 Jolly Jumpers
uva10038 Jolly Jumpers
44 0
uva10112 Myacm Triangles
uva10112 Myacm Triangles
45 0
UVa11776 - Oh Your Royal Greediness!
UVa11776 - Oh Your Royal Greediness!
56 0
UVa 10082 WERTYU
Problem Description A common typing error is to place the hands on the keyboard one row to the right of the correct position.
891 0
|
算法
UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics 10300 - Ecological Premium 458 - The Decoder 494...
1570 0
|
C++
UVA 之10010 - Where's Waldorf?
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/SunnyYoona/article/details/24863879 ...
713 0
uva 11806 - Cheerleaders
点击打开链接 题意:在一个n行m列的矩形里面放k个相同的石子,要求第一行,最后一行,第一列,最后一列都要有石子。问有几种方法? 思路: 1 如果题目没有要求“第一行,最后一行,第一列,最后一列都要有石子”,那么答案就是C[n*m][k],我们用C[i][j]表示i个里面选择j个的组合数。
825 0