summaryrefslogtreecommitdiffstats
path: root/mat/advent
diff options
context:
space:
mode:
Diffstat (limited to 'mat/advent')
-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
5 files changed, 30 insertions, 0 deletions
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;
+}