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

sumzerotodigits.c (395B)


      1 #include "../test.h"
      2 
      3 void sumzerotodigits(int64_t, 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 d;
      9 
     10 	fgets(str, STRLENMAX, stdin);
     11 	n = atoi(str);
     12 	fgets(str, STRLENMAX, stdin);
     13 	b = atoi(str);
     14 	fgets(str, STRLENMAX, stdin);
     15 	d = atoll(str);
     16 
     17 	sumzerotodigits(d, n, b, a);
     18 	
     19 	for (i = 0; i < n; i++)
     20 		printf("%" PRIu8 "\n", a[i]);
     21 }