summaryrefslogtreecommitdiffstats
path: root/mat/advent
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-14 00:04:39 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-14 00:04:39 +0100
commitddff09bb8def69d35c43649736dd4c3a5f0aef7f (patch)
tree776b3e0fa9a05c6feab0b753ed21ab011ff28afd /mat/advent
parentweekend reading 6 (diff)
parentodstranil dependency za f5ff, domača naloga 20 pri matematiki (diff)
downloadsola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar.gz
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar.bz2
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar.lz
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar.xz
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.tar.zst
sola-gimb-2-ddff09bb8def69d35c43649736dd4c3a5f0aef7f.zip
Diffstat (limited to 'mat/advent')
-rw-r--r--mat/advent/4/Makefile3
-rwxr-xr-xmat/advent/4/a.outbin0 -> 8432 bytes
-rwxr-xr-xmat/advent/4/n1bin0 -> 8432 bytes
-rw-r--r--mat/advent/4/n1.c22
-rw-r--r--mat/advent/4/prog.c16
-rw-r--r--mat/advent/5/Makefile2
-rw-r--r--mat/advent/5/advent5.ggbbin0 -> 18797 bytes
-rwxr-xr-xmat/advent/5/n1bin0 -> 8344 bytes
-rw-r--r--mat/advent/5/n1.c12
-rw-r--r--mat/advent/6/Makefile3
-rwxr-xr-xmat/advent/6/a.outbin0 -> 8344 bytes
-rwxr-xr-xmat/advent/6/n1bin0 -> 8344 bytes
-rw-r--r--mat/advent/6/n1.c14
-rw-r--r--mat/advent/6/prog.c13
14 files changed, 85 insertions, 0 deletions
diff --git a/mat/advent/4/Makefile b/mat/advent/4/Makefile
new file mode 100644
index 0000000..cb76e0f
--- /dev/null
+++ b/mat/advent/4/Makefile
@@ -0,0 +1,3 @@
+default:
+ gcc prog.c -pedantic
+ gcc n1.c -pedantic -o n1
diff --git a/mat/advent/4/a.out b/mat/advent/4/a.out
new file mode 100755
index 0000000..c1c724c
--- /dev/null
+++ b/mat/advent/4/a.out
Binary files differ
diff --git a/mat/advent/4/n1 b/mat/advent/4/n1
new file mode 100755
index 0000000..9d59953
--- /dev/null
+++ b/mat/advent/4/n1
Binary files differ
diff --git a/mat/advent/4/n1.c b/mat/advent/4/n1.c
new file mode 100644
index 0000000..157d60d
--- /dev/null
+++ b/mat/advent/4/n1.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+int main (int argc, char ** argv) {
+ if (argc != 1+2) {
+ fprintf(stderr, "uporaba: %s <število> <število>\nprimer-število deliteljev 3019, ki niso delitelji 2020: %s 3019 2020\n", argv[0], argv[0]);
+ return 1;
+ }
+ unsigned long int n = strtol(argv[1], NULL, 10);
+ unsigned long int o = strtol(argv[2], NULL, 10);
+ unsigned long int i = 0;
+ unsigned long int s = 0;
+ unsigned long int d = 0;
+ for (i = 1; i <= n; i++)
+ if (n % i == 0) {
+ d++;
+ if (o % i != 0)
+ s++;
+ }
+ fprintf(stdout, "števil, ki delijo %lu (=%lu), ne pa %lu, je %lu\n", n,d,o,s);
+ return 0;
+}
diff --git a/mat/advent/4/prog.c b/mat/advent/4/prog.c
new file mode 100644
index 0000000..a50524f
--- /dev/null
+++ b/mat/advent/4/prog.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ if (argc != 1+1) {
+ fprintf(stderr, "uporaba: %s <dolzina stranice kvadratne mreze>\nprimer za šahovnico: %s 8\n", argv[0], argv[0]);
+ return 1;
+ }
+ unsigned long int n = strtol(argv[1], NULL, 10);
+ unsigned long int x = 1;
+ unsigned long int y = 1;
+ unsigned long int s = 0;
+ for (x = 1; x <= n; x++)
+ for (y = 1; y <= n; y++)
+ s = s + x * y;
+ fprintf(stdout, "seštevek možnih pravokotnikov v mreži %lux%lu je %lu\n", n, n, s);
+}
diff --git a/mat/advent/5/Makefile b/mat/advent/5/Makefile
new file mode 100644
index 0000000..34bc506
--- /dev/null
+++ b/mat/advent/5/Makefile
@@ -0,0 +1,2 @@
+default:
+ gcc n1.c -pedantic -o n1
diff --git a/mat/advent/5/advent5.ggb b/mat/advent/5/advent5.ggb
new file mode 100644
index 0000000..709a1e3
--- /dev/null
+++ b/mat/advent/5/advent5.ggb
Binary files differ
diff --git a/mat/advent/5/n1 b/mat/advent/5/n1
new file mode 100755
index 0000000..ae9cfe7
--- /dev/null
+++ b/mat/advent/5/n1
Binary files differ
diff --git a/mat/advent/5/n1.c b/mat/advent/5/n1.c
new file mode 100644
index 0000000..2d3c38f
--- /dev/null
+++ b/mat/advent/5/n1.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+#define ce if
+#define stevilka int
+#define niz char **
+#define glavna main
+#define za for
+stevilka glavna (stevilka argc, niz argv) {
+ za (stevilka i = 10; i <= 99; i++) {
+ ce (i*10+2 == (2*100+i) + 72)
+ fprintf(stderr, "našel številko %d2\n", i);
+ }
+}
diff --git a/mat/advent/6/Makefile b/mat/advent/6/Makefile
new file mode 100644
index 0000000..1e287d6
--- /dev/null
+++ b/mat/advent/6/Makefile
@@ -0,0 +1,3 @@
+default:
+ gcc -pedantic prog.c
+ gcc -pedantic n1.c -on1
diff --git a/mat/advent/6/a.out b/mat/advent/6/a.out
new file mode 100755
index 0000000..2b0aca5
--- /dev/null
+++ b/mat/advent/6/a.out
Binary files differ
diff --git a/mat/advent/6/n1 b/mat/advent/6/n1
new file mode 100755
index 0000000..1ca7db2
--- /dev/null
+++ b/mat/advent/6/n1
Binary files differ
diff --git a/mat/advent/6/n1.c b/mat/advent/6/n1.c
new file mode 100644
index 0000000..4f4a5a2
--- /dev/null
+++ b/mat/advent/6/n1.c
@@ -0,0 +1,14 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ unsigned int s = 1; /* seštevek */
+ unsigned int i = 0; /* indeks */
+ while (1) {
+ i++;
+ s = s*3;
+ if (s > 2020)
+ break;
+ }
+ fprintf(stdout, "H_%u ima ploščino, enako %u-kratniku ploščine H_0.\n", i, s);
+ return 0;
+}
diff --git a/mat/advent/6/prog.c b/mat/advent/6/prog.c
new file mode 100644
index 0000000..14eb68a
--- /dev/null
+++ b/mat/advent/6/prog.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main (int argc, char ** argv) {
+ double x;
+ size_t s = 0;
+ for (double a = 1; a <= 2020; a++) {
+ x = ((float)7/(float)5)*(float)a;
+ if (x == (int)x)
+ s++;
+ }
+ fprintf(stderr, "%lu\n", s);
+ return 0;
+}