algorithms

Algorithm implementations
git clone git://git.laack.co/algorithms.git
Log | Files | Refs | README

commit 1d50d7c09fe35fe9d180964ae78a8a634a69bd01
parent d9681d12ff8ecd672635f0bf5adacc1b54c2e2ee
Author: Andrew Laack <andrew@laack.co>
Date:   Wed, 11 Nov 2026 15:14:15 -0600

Kattis problem in ocaml

Diffstat:
Acomp/pot/ex1.in | 3+++
Acomp/pot/ex2.in | 6++++++
Acomp/pot/ex3.in | 4++++
Acomp/pot/main.ml | 9+++++++++
Acomp/pot/problem.txt | 1+
Acomp/vlad-and-a-sum-of-digits/exbigger.in | 8++++++++
6 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/comp/pot/ex1.in b/comp/pot/ex1.in @@ -0,0 +1,3 @@ +2 +212 +1253 diff --git a/comp/pot/ex2.in b/comp/pot/ex2.in @@ -0,0 +1,6 @@ +5 +23 +17 +43 +52 +22 diff --git a/comp/pot/ex3.in b/comp/pot/ex3.in @@ -0,0 +1,4 @@ +3 +213 +102 +45 diff --git a/comp/pot/main.ml b/comp/pot/main.ml @@ -0,0 +1,9 @@ +let rec pow base exp = if exp = 0 then 1 else base * pow base (exp - 1) in +let rec handleTestCases num = + if num == 0 then 0 + else + let current = read_int () in let rem = current mod 10 in + pow (current / 10) rem + handleTestCases (num - 1) +in +let testCases = read_int () in +print_int (handleTestCases testCases); print_newline () diff --git a/comp/pot/problem.txt b/comp/pot/problem.txt @@ -0,0 +1 @@ +https://open.kattis.com/contests/tpieft/problems/pot diff --git a/comp/vlad-and-a-sum-of-digits/exbigger.in b/comp/vlad-and-a-sum-of-digits/exbigger.in @@ -0,0 +1,8 @@ +7 +46160173 +46160173 +46160173 +46160173 +46160173 +46160173 +46160173