blob: a366ec97e78d7b3dff8fd87df7468cc1487dbacc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <stdlib.h>
#include <stdio.h>
#include "solver.h"
int main(int argc, char **argv)
{
const char *arg0 = *argv++;
vect_t vect;
if (argc < 3)
goto usage;
vect.len = argc - 2;
vect.array = malloc(sizeof(int) * vect.len);
for (int i = 0; i < (signed)vect.len; ++i) {
vect.array[i] = atoi(*argv++);
}
solve(&vect, atoi(*argv));
free(vect.array);
return 0;
usage:
fprintf(stderr, "Usage: %s number ... result\n", arg0);
return -1;
}
|