summaryrefslogtreecommitdiffstats
path: root/mat
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-12-02 14:30:10 +0100
committersijanec <sijanecantonluka@gmail.com>2020-12-02 14:30:10 +0100
commit8d4a349ea228eb79808657a1404c3786638a2802 (patch)
tree5a940cb177a3c83d415777dede5fea4c4aa28434 /mat
parentamat: famnitov adventni matematični kviz: naloga 1 - dodane stvari - RIP (diff)
downloadsola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar.gz
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar.bz2
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar.lz
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar.xz
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.tar.zst
sola-gimb-2-8d4a349ea228eb79808657a1404c3786638a2802.zip
Diffstat (limited to 'mat')
-rwxr-xr-xmat/advent/2/a.outbin0 -> 12624 bytes
-rw-r--r--mat/advent/2/prog.c25
2 files changed, 25 insertions, 0 deletions
diff --git a/mat/advent/2/a.out b/mat/advent/2/a.out
new file mode 100755
index 0000000..00889d8
--- /dev/null
+++ b/mat/advent/2/a.out
Binary files differ
diff --git a/mat/advent/2/prog.c b/mat/advent/2/prog.c
new file mode 100644
index 0000000..663fe8f
--- /dev/null
+++ b/mat/advent/2/prog.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char ** argv) {
+ if (argc != 1+11) {
+ fprintf(stderr, "uporaba: %s <stevilka> (=) <stevilka>(x) (+) <stevilka>(y) (+) <stevilka>(z) (;) <stevilka> (=) <stevilka>(x) (+) <stevilka>(y) (+) <stevilka>(z) <min> <max> <step>\nprimer: %s 53 3 2 5 91 5 3 9 0 100 1\n", argv[0], argv[0]);
+ return 1;
+ }
+ unsigned int i;
+ double j[3];
+ double n[8];
+ double min = atoi(argv[9]);
+ double max = atoi(argv[10]);
+ double step = atoi(argv[11]);
+ for (i = 1; i <= 8; i++)
+ n[i-1] = atof(argv[i]);
+ for (j[0] = min; j[0] <= max; j[0]++)
+ for (j[1] = min; j[1] <= max; j[1]++)
+ for (j[2] = min; j[2] <= max; j[2]++)
+ if ((n[0] == n[1] * j[0] + n[2] * j[1] + n[3] * j[2])
+ && (n[4] == n[5] * j[0] + n[6] * j[1] + n[7] * j[2]))
+ fprintf (stdout, "našel: %f = %f * %f + %f * %f + %f * %f ; "
+ "%f = %f * %f + %f * %f + %f * %f\n", n[0], n[1], j[0], n[2], j[1], n[3], j[2], n[4], n[5], j[0], n[6], j[1], n[7], j[2]);
+ return 0;
+}