summaryrefslogtreecommitdiffstats
path: root/inf/zotks/2
diff options
context:
space:
mode:
Diffstat (limited to 'inf/zotks/2')
-rwxr-xr-xinf/zotks/2/1bin0 -> 17064 bytes
-rwxr-xr-xinf/zotks/2/2bin0 -> 16992 bytes
-rw-r--r--inf/zotks/2/Sosedska_stevila.c60
-rwxr-xr-xinf/zotks/2/a.outbin0 -> 17064 bytes
-rw-r--r--inf/zotks/2/sn2.c28
-rw-r--r--inf/zotks/2/ž20
6 files changed, 108 insertions, 0 deletions
diff --git a/inf/zotks/2/1 b/inf/zotks/2/1
new file mode 100755
index 0000000..27f5015
--- /dev/null
+++ b/inf/zotks/2/1
Binary files differ
diff --git a/inf/zotks/2/2 b/inf/zotks/2/2
new file mode 100755
index 0000000..f3c96af
--- /dev/null
+++ b/inf/zotks/2/2
Binary files differ
diff --git a/inf/zotks/2/Sosedska_stevila.c b/inf/zotks/2/Sosedska_stevila.c
new file mode 100644
index 0000000..eb06702
--- /dev/null
+++ b/inf/zotks/2/Sosedska_stevila.c
@@ -0,0 +1,60 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+int popravi(char * b) {
+ int i = 0;
+ int spremenil = 0;
+ for (i = strlen(b)-1; i > 0; i--) {
+ if (b[i] > '9') {
+ b[i] = '0';
+ b[i-1]++;
+ spremenil++;
+ }
+ }
+ if (b[0] > '9') {
+ /* fprintf(stderr, "debug\n");; */
+ memcpy(b+1, b, 24);
+ b[1] = '0';
+ b[0] = '1';
+ spremenil++;
+ }
+ return spremenil;
+}
+int jeok (char * b) {
+ int se_enkrat = 0;
+ for (int i = 0; b[i+1] != '\0'; i++) {
+ if (b[i] == b[i+1]) {
+ b[i+2]++;
+ if (popravi(b))
+ se_enkrat++;
+ }
+ }
+ if (se_enkrat)
+ return jeok(b);
+ return 0;
+}
+int main (int argc, char ** argv) {
+ char b[25]; /* vemo, kako veliko je št */
+ char c = fgetc(stdin);
+ unsigned long long int i = 0;
+ while (!feof(stdin)) {
+ b[i++] = c;
+ c = fgetc(stdin);
+ }
+ b[i--] = '\0';
+ fprintf(stderr, "poganjam %s\n", b);
+ fflush(stderr);
+ b[i]++;
+ popravi(b);
+ jeok(b);
+ fprintf(stdout, "%s\n", b);
+ return 0;
+}
+/*
+ int main (int argc, char ** argv) {
+ char c[1234];
+ strcpy(c, argv[1]);
+ popravi(c);
+ fprintf(stdout, "%s\n", c);
+ }
+*/
diff --git a/inf/zotks/2/a.out b/inf/zotks/2/a.out
new file mode 100755
index 0000000..4853087
--- /dev/null
+++ b/inf/zotks/2/a.out
Binary files differ
diff --git a/inf/zotks/2/sn2.c b/inf/zotks/2/sn2.c
new file mode 100644
index 0000000..d919a95
--- /dev/null
+++ b/inf/zotks/2/sn2.c
@@ -0,0 +1,28 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+int main (int argc, char ** argv) {
+ /* bom pa tko, če nisem sposoben */
+ /* NEVER EVER DO THIS */
+ char c[128];
+ char *p = fgets(c, 128, stdin);
+ p++;
+ unsigned long long int i = strtoll(c, NULL, 10);
+ i++;
+ int cast = 0;
+label:
+ sprintf(c, "%llu", i);
+ int k = strlen(c);
+ for (int j = 0; j < k; j++) {
+ if (c[j] == c[j+1]) {
+ i += pow(10, k-(j+2));
+ fprintf(stderr, "cd: %llu\n", i);
+ // cast = pow(10, k-(j+2));
+ // i -= i % cast;
+ goto label;
+ }
+ }
+ fprintf(stdout, "%llu\n", i);
+ return 0;
+}
diff --git a/inf/zotks/2/ž b/inf/zotks/2/ž
new file mode 100644
index 0000000..c7f947a
--- /dev/null
+++ b/inf/zotks/2/ž
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+#include <stdio.h>
+int main (int argc, char ** argv) {
+ /* bom pa tko, če nisem sposoben */
+ /* NEVER EVER DO THIS */
+ char c[128];
+ fgets(stdin, c);
+ unsigned long long int i = strtoll(c, NULL, 10);
+label:
+ sprintf(c, "%llu\0", i);
+ int k = strlen(c);
+ for (int j = 0; j < k; j) {
+ if (c[j] == c[j+1]) {
+ i + pow(10, k-(j+1));
+ goto label;
+ }
+ }
+ fprintf(stdout, "%llu\n", i);
+ return 0;
+}