Added timer for bests solutions
This commit is contained in:
11
lceb.c
11
lceb.c
@@ -12,6 +12,7 @@
|
||||
#include <stdarg.h>
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include "lceb.h"
|
||||
|
||||
int main(ac, av)
|
||||
@@ -20,19 +21,20 @@ int main(ac, av)
|
||||
{
|
||||
unsigned target;
|
||||
STACK inputstack, *stack;
|
||||
int i, j, k, stacksize, val, res;
|
||||
//char *ops="+-*/", *opscomb;
|
||||
//int len_ops=strlen(ops), ncombs, nops;
|
||||
int i, j, k, stacksize, val;
|
||||
int ncombs, nstacks, ntrees, nops;
|
||||
TREE *tree;
|
||||
int intarray[1024];
|
||||
int eval;
|
||||
char *comb;
|
||||
struct timespec end;
|
||||
|
||||
setlocale(LC_ALL, ""); /* to use "%'d" in printf */
|
||||
if (ac < 4 || ac > 2+MAXINPUT) {
|
||||
fprintf(stderr, "usage: %s target n1 n2 [...n%d]\n", *av, MAXINPUT);
|
||||
exit(1);
|
||||
}
|
||||
start_timer();
|
||||
target=atoi(av[1]);
|
||||
stacksize=2*(ac-2)-1;
|
||||
nops=ac-2-1;
|
||||
@@ -110,5 +112,8 @@ int main(ac, av)
|
||||
}
|
||||
printf("\n");
|
||||
print_bests();
|
||||
set_timer(&end);
|
||||
printf("Total time elapsed: %.5f secs, nodes/leaves evaluated:%'d/%'d\n",
|
||||
get_timer(end), get_totnodes(), get_totleaves());
|
||||
exit(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user