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
64
2025.03.07/01Ex/main.c
Normal file
64
2025.03.07/01Ex/main.c
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "array_io.h"
|
||||
#include "io_status.h"
|
||||
#include "solve.h"
|
||||
|
||||
/* ./a.out n p k [filename] */
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
double t, *a;
|
||||
int n, p, k, res, task = 1;
|
||||
char *name = 0;
|
||||
|
||||
if (!((argc == 4 || argc == 5) &&
|
||||
sscanf(argv[1], "%d", &n) == 1 &&
|
||||
sscanf(argv[2], "%d", &p) == 1 &&
|
||||
sscanf(argv[3], "%d", &k) == 1 &&
|
||||
k >= 0 && k <= 4 && (!(k == 0 && argc != 5))))
|
||||
{
|
||||
printf("Usage: %s n p k [filename]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if (argc == 5) name = argv[4];
|
||||
|
||||
a = (double *)malloc(n * n * sizeof(double));
|
||||
if (!a)
|
||||
{
|
||||
printf("Not enough memory\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (name)
|
||||
{ /* из файла */
|
||||
io_status ret;
|
||||
ret = read_sq_matrix(a, n, name);
|
||||
do {
|
||||
switch (ret)
|
||||
{
|
||||
case SUCCESS:
|
||||
continue;
|
||||
case ERROR_OPEN:
|
||||
printf("Cannot open %s\n", name);
|
||||
break;
|
||||
case ERROR_READ:
|
||||
printf("Cannot read %s\n", name);
|
||||
}
|
||||
free(a);
|
||||
return 3;
|
||||
} while (0);
|
||||
} else init_sq_matrix(a, n, k);
|
||||
|
||||
printf("Initial matrix:\n");
|
||||
print_sq_matrix(a, n, p);
|
||||
|
||||
t = clock();
|
||||
res = t1_solve(a, n);
|
||||
t = (clock() - t) / CLOCKS_PER_SEC;
|
||||
|
||||
printf("Result = %d\n", res);
|
||||
printf("%s : Task = %d Elapsed = %.2f\n", argv[0], task, t);
|
||||
free(a);
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue