This commit is contained in:
mallowday 2024-02-01 11:16:15 +09:00
parent 3ad0a253c6
commit 0f49a1ebae

View file

@ -2,33 +2,33 @@
#include <stdlib.h>
#include <string.h>
int compare_strings(const void *string1, const void *string2);
int cmp_str(const void *str1, const void *str2);
int main(void)
{
int i;
int number_strings;
int string_length;
char strings[100][100 + 1];
int num;
int len;
char strs[100][100 + 1];
scanf("%d %d", &number_strings, &string_length);
scanf("%d %d", &num, &len);
i = 0;
while (i < number_strings)
while (i < num)
{
scanf("%s", strings[i]);
scanf("%s", strs[i]);
++i;
}
qsort(strings, number_strings, sizeof(strings[0]), compare_strings);
qsort(strs, num, sizeof(strs[0]), cmp_str);
i = 0;
while (i < number_strings)
while (i < num)
{
printf("%s", strings[i]);
printf("%s", strs[i]);
++i;
}
puts("");
}
int compare_strings(const void *string1, const void *string2)
int cmp_str(const void *str1, const void *str2)
{
return (strcmp(string1, string2));
return (strcmp(str1, str2));
}