diff options
author | sijanec <anton@sijanec.eu> | 2021-02-11 18:01:40 +0100 |
---|---|---|
committer | sijanec <anton@sijanec.eu> | 2021-02-11 18:01:40 +0100 |
commit | fe9f8b1bdde07a564e9097e4b2bb433634690983 (patch) | |
tree | 35db8d767e7845776fab9aedb687093fdb05b544 /inf/zotks/2/sn2.c | |
parent | dokument.md ang readings 9 (diff) | |
download | sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.gz sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.bz2 sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.lz sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.xz sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.tar.zst sola-gimb-2-fe9f8b1bdde07a564e9097e4b2bb433634690983.zip |
Diffstat (limited to 'inf/zotks/2/sn2.c')
-rw-r--r-- | inf/zotks/2/sn2.c | 28 |
1 files changed, 28 insertions, 0 deletions
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; +} |