From 269d3fa92201f468a30215773d9a3fd40bc430e3 Mon Sep 17 00:00:00 2001 From: sijanec Date: Fri, 11 Dec 2020 23:28:35 +0100 Subject: =?UTF-8?q?=C5=A1ola=2010.=20dcembra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mat/advent/6/Makefile | 3 +++ mat/advent/6/a.out | Bin 0 -> 8344 bytes mat/advent/6/n1 | Bin 0 -> 8344 bytes mat/advent/6/n1.c | 14 ++++++++++++++ mat/advent/6/prog.c | 13 +++++++++++++ 5 files changed, 30 insertions(+) create mode 100644 mat/advent/6/Makefile create mode 100755 mat/advent/6/a.out create mode 100755 mat/advent/6/n1 create mode 100644 mat/advent/6/n1.c create mode 100644 mat/advent/6/prog.c (limited to 'mat') 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 Binary files /dev/null and b/mat/advent/6/a.out differ diff --git a/mat/advent/6/n1 b/mat/advent/6/n1 new file mode 100755 index 0000000..1ca7db2 Binary files /dev/null and b/mat/advent/6/n1 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 +#include +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 +#include +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; +} -- cgit v1.2.3