summaryrefslogtreecommitdiffstats
path: root/inf/rtk/šolsko/1
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-02-02 22:39:19 +0100
committerAnton Luka Šijanec <anton@sijanec.eu>2022-02-02 22:39:19 +0100
commit3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5 (patch)
tree3e7821a6bfca04de0ecf851a41ae00e3b7caa648 /inf/rtk/šolsko/1
parentdnmat (diff)
downloadsola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar.gz
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar.bz2
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar.lz
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar.xz
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.tar.zst
sola-gimb-3-3c3c3a6b1ab5a98ef4f400d5aa615ddabf3b94c5.zip
Diffstat (limited to '')
-rwxr-xr-xinf/rtk/šolsko/1bin0 -> 18120 bytes
-rw-r--r--inf/rtk/šolsko/1.c24
-rw-r--r--inf/rtk/šolsko/1.txt6
3 files changed, 30 insertions, 0 deletions
diff --git a/inf/rtk/šolsko/1 b/inf/rtk/šolsko/1
new file mode 100755
index 0000000..e8daf5b
--- /dev/null
+++ b/inf/rtk/šolsko/1
Binary files differ
diff --git a/inf/rtk/šolsko/1.c b/inf/rtk/šolsko/1.c
new file mode 100644
index 0000000..f93eb94
--- /dev/null
+++ b/inf/rtk/šolsko/1.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+int main (void) {
+ char buf[1024];
+ double z = 0;
+ fgets(buf, 1024, stdin); /* prva vrstica ni potrebna */
+ fgets(buf, 1024, stdin);
+ while (!feof(stdin)) { /* gremo čez vsako vrstico */
+ int i = 0; /* indeks */
+ int m = 1; /* trenutni imenovalec */
+ do {
+ m *= 2; /* povečamo trenutni imenovalec */
+ if (buf[i] == 'S') {
+ z += 1 / (double) m; /* povečamo za trenutno velikost kosa */
+ /* fprintf(stderr, "sadi, %d, %f\n", m, z); */
+ }
+ i++;
+ } while (buf[i-1] != '\n' && buf[i-1] != 0 && buf[i-1] != '\r'); /* konec vhoda */
+ fgets(buf, 1024, stdin); /* poberemo novo vrstico */
+ }
+ printf("%d\n", (int) ceil(z)); /* izpišemo vrednost, zaokroženo navzgor */
+ return 0; /* končamo program */
+}
diff --git a/inf/rtk/šolsko/1.txt b/inf/rtk/šolsko/1.txt
new file mode 100644
index 0000000..6a912d3
--- /dev/null
+++ b/inf/rtk/šolsko/1.txt
@@ -0,0 +1,6 @@
+5 4
+SJSJ
+SSJJ
+JSJJ
+JJJJ
+JJSJ