summaryrefslogtreecommitdiffstats
path: root/mat/euler/17/prog.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--mat/euler/17/prog.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/mat/euler/17/prog.c b/mat/euler/17/prog.c
new file mode 100644
index 0000000..afa005d
--- /dev/null
+++ b/mat/euler/17/prog.c
@@ -0,0 +1,28 @@
+#include <stdio.h>
+#include <stdlib.h>
+#define DISABLE_LIB_TESTS 1
+#include <angnum.c>
+int main (int argc, char ** argv) {
+ if (argc != 1+2) {
+ fprintf(stderr, "uporaba: %s <stevilka>\nprimer-sešteje črke v ang številih od 1 do 1000: %s 1 1000\n", argv[0], argv[0]);
+ return 1;
+ }
+ long long int a = strtoll(argv[1], NULL, 10);
+ long long int b = strtoll(argv[2], NULL, 10);
+ unsigned long long int i = 0; // lenasI
+ long long int j = 0; // Janez je podpisan, da se po 0 ne obrne (:
+ unsigned long long int e = 0; // sEštevek
+ char * s = malloc(sizeof(char)*MX_NS_L);
+ for (i = a; i <= b; i++) {
+ // fprintf(stderr, "\rračunam ... preostane še %llu operacij.", b-i);
+ j = angnum(i, s, MX_NS_L);
+ if (j == 0)
+ return 2;
+ for (j-- /* da ne gledamo nul bajta na koncu (: */ ; j >= 0; j--) {
+ if (s[j] >= 'a' && s[j] <= 'z') // that's why I like C
+ e++;
+ }
+ }
+ fprintf(stdout, "\rkonec. seštevek črk je %llu.\n", e);
+ return 0;
+}