题目: |
var
data : array[1..20] of integer;
n,i,h,ans : integer;
procedure merge;
begin
data[h-1] := data[h-1] + data[h];
dec(h);
inc(ans);
end;
begin
readln(n);
h := 1;
data[h] := 1;
ans := 0;
for i:=2 to n do
begin
inc(h);
data[h] := 1;
while (h>1) and (data[h]=data[h-1]) do
merge;
end;
writeln(ans);
end.
(1)
输入:8
输出:______________ (5分)
(2)
输入:2016
输出:______________ (5分)
输出:7|2010
|