aboutsummaryrefslogtreecommitdiff
path: root/test/013_math_digitstosumzero/digitstosumzero_tests.c
blob: 795bd9b03892d45e9d5c3a0523b1da81622bca0c (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"

int64_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;
	int64_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("%" PRId64 "\n", p);
}

Generated with cgit - Back to sebastiano.tronto.net