const
num = 5;
var
n: integer;
function r(n : integer) : integer;
var
i : integer;
begin
if n <= num then
begin
r := n;
exit;
end;
for i :=1 to num do
if r(n-i) < 0 then
begin
r:=i;
exit;
end;
r:=-1;
end;
begin
readln(n);
writeln(r(n));
end.
输入 16
输出:4
|