h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

digitstosumzero_tests.c (405B)


      1 #include "../test.h"
      2 
      3 int64_t digitstosumzero(size_t n, uint8_t [n], uint8_t);
      4 
      5 void run(void) {
      6 	char str[STRLENMAX];
      7 	uint8_t i, b, a[100];
      8 	size_t n;
      9 	int64_t p;
     10 
     11 	fgets(str, STRLENMAX, stdin);
     12 	n = atoi(str);
     13 	fgets(str, STRLENMAX, stdin);
     14 	b = atoi(str);
     15 	for (i = 0; i < n; i++) {
     16 		fgets(str, STRLENMAX, stdin);
     17 		a[i] = atoi(str);
     18 	}
     19 
     20 	p = digitstosumzero(n, a, b);
     21 	printf("%" PRId64 "\n", p);
     22 }