aboutsummaryrefslogtreecommitdiff
path: root/test/013_math_digitstosumzero/digitstosumzero_tests.c
blob: 5c9308369e6127d568efa2eb406a4248e31665c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "../test.h"

uint64_t digitstosumzero(size_t n, uint8_t [n], uint8_t);

void run(void) {
	char str[STRLENMAX];
	uint8_t i, b, a[100];
	size_t n;
	uint64_t p;

	fgets(str, STRLENMAX, stdin);
	n = atoi(str);
	fgets(str, STRLENMAX, stdin);
	b = atoi(str);
	for (i = 0; i < n; i++) {
		fgets(str, STRLENMAX, stdin);
		a[i] = atoi(str);
	}

	p = digitstosumzero(n, a, b);
	printf("%" PRIu64 "\n", p);
}

Generated with cgit - Back to sebastiano.tronto.net