题目: |
const
size = 100;
var
na, nb, i, j, k : integer;
a, b : array[1..size] of integer;
begin
readln(na);
for i := 1 to na do
read(a[i]);
readln(nb);
for i := 1 to nb do
read(b[i]);
i := 1;
j := 1;
while (i <= na) and (j <= nb) do
begin
if a[i] <= b[j] then
begin
write(a[i],' ');
inc(i);
end
else begin
write(b[j], ' ');
inc(j);
end;
end;
if i <= na then
for k := i to na do
write(a[k], ' ');
if j <= nb then
for k := j to nb do
write(b[k], ' ');
end.
输入
5
1 3 5 7 9
4
2 6 10 14 输出:1 2 3 5 6 7 9 10 14
|