summaryrefslogtreecommitdiffstats
path: root/šola/p1/dn/DN01_naivno.c
blob: ae6547ca1416cb2afd9a7ced38b5dc9c01f0bbee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>
int main (int argc, char ** argv) {
	if (argc != 3) {
		fprintf(stderr, "%s a b\n", argv[0]);
		return 1;
	}
	int a = atoi(argv[1]);
	int b = atoi(argv[2]);
	if (b < a) {
		int temp = a;
		a = b;
		b = temp;
	}
	int sum = 0;
	for (int s = 1; s < a; s++) {
		fprintf(stderr, "D: %d\ts=%d, a=%d, b=%d\n", (a-s)*(b-s), s, a, b);
		sum += (a-s)*(b-s);
	}
	printf("%d\n", sum);
}