DIOPHANT: procedure expose A.
parse arg N, T
call
QUICKSORT
N
Ls.1 = A.1
do I = 2 to N
Im1 = I - 1; Ls.I = A.I + Ls.Im1
end
if A.1 <= T & T <= Ls.N then do
S = 1; Stack.1 = N T
do while S > 0
parse var Stack.S R T V; S = S - 1
do K = 1 while Ls.K < T; end
if Ls.K = T then call EXIST V, K, 1
do while A.R > T; R = R - 1; end
if A.R = T then call EXIST V, R, R
do L = K to R while A.1 <= T - A.L
D = V A.L; S = S + 1
Stack.S = (L - 1) (T - A.L) D
end
end
end
say "Solution not exist"
exit
EXIST: procedure expose A.
parse arg V, B, E
do J = B to E by -1; V = V A.J; end
say "Solution:" V
exit