summaryrefslogtreecommitdiffstats
path: root/mat/advent/7
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-14 12:43:58 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-14 12:43:58 +0100
commit66ca421a2ce5b16a2f4b8439795e230882773bac (patch)
tree8576342348826c92f68789ee9c84a194d258e003 /mat/advent/7
parentadvent 7 (diff)
downloadsola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar.gz
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar.bz2
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar.lz
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar.xz
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.tar.zst
sola-gimb-2-66ca421a2ce5b16a2f4b8439795e230882773bac.zip
Diffstat (limited to 'mat/advent/7')
-rwxr-xr-xmat/advent/7/a.outbin8432 -> 8432 bytes
-rw-r--r--mat/advent/7/prog.c6
2 files changed, 3 insertions, 3 deletions
diff --git a/mat/advent/7/a.out b/mat/advent/7/a.out
index 66f1e58..490d8e4 100755
--- a/mat/advent/7/a.out
+++ b/mat/advent/7/a.out
Binary files differ
diff --git a/mat/advent/7/prog.c b/mat/advent/7/prog.c
index 7549d6b..974a390 100644
--- a/mat/advent/7/prog.c
+++ b/mat/advent/7/prog.c
@@ -16,10 +16,10 @@ int main (int argc, char ** argv) {
unsigned long long int r = 0;
unsigned long long int s = 0; /* število najdenih in zapiSanih trojk */
for (x = b; x > 0; x--) {
- for (y = x; y > 0; y--) {
- for (z = y; z > 0; z--) {
+ for (y = x-1; y > 0; y--) {
+ for (z = y-1; z > 0; z--) {
r++;
- /* fprintf(stderr, "sum = %lu\n", x+y+z); */
+ /* fprintf(stderr, "%lu, %lu, %lu\n", x, y, z); */
if ((x+y+z) % 3 == 0) {
s++;
}