refactor(structure): normalize folder names with leading zeros for consistency
- Renamed all folders from format NEx (e.g., 1Ex, 2Ex...) to 0NEx (01Ex, 02Ex, etc.) - Updated subdirectories and files accordingly - Removed old main Makefile and tasks (a01.c–a09.c, solve.c, io_status.h), likely obsolete - Cleaned up deprecated task binaries and configs
This commit is contained in:
parent
2cf18a1ff3
commit
8a7aac7c23
385 changed files with 2 additions and 1468 deletions
21
2025.02.28/06Ex/solve.c
Normal file
21
2025.02.28/06Ex/solve.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include "solve.h"
|
||||
|
||||
void t6_solve(char **a, int n, int (*cmp)(const char *, const char *))
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < n; ++i) append(a, i+1, a[i], find(a, i, a[i], cmp));
|
||||
}
|
||||
|
||||
int find(char **arr, int n, char *a, int (*cmp)(const char *, const char *))
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<n; ++i) if (cmp(a, arr[i]) < 0) break;
|
||||
return i;
|
||||
}
|
||||
|
||||
void append(char **arr, int n, char *a, int index)
|
||||
{
|
||||
for (int i = n-1; i > index; --i) arr[i] = arr[i-1];
|
||||
arr[index] = a;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue