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 (394B)


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