about summary refs log tree commit diff
path: root/others/volume1/062.pas
diff options
context:
space:
mode:
Diffstat (limited to 'others/volume1/062.pas')
-rw-r--r--others/volume1/062.pas29
1 files changed, 29 insertions, 0 deletions
diff --git a/others/volume1/062.pas b/others/volume1/062.pas
new file mode 100644
index 0000000..715d005
--- /dev/null
+++ b/others/volume1/062.pas
@@ -0,0 +1,29 @@
+var
+  m, n, i: int16;
+  a: array of int32;
+  b: int32;
+
+begin
+  readln(m, n);
+  setlength(a, m);
+  for i := 0 to m - 1 do
+    read(a[i]);
+  i := 0;
+  repeat
+    read(b);
+    while (i < m) and
+          (a[i] <= b) do
+      begin
+        write(a[i], ' ');
+        inc(i)
+      end;
+    write(b, ' ');
+    dec(n)
+  until n = 0;
+  while i < m do
+    begin
+      write(a[i], ' ');
+      inc(i)
+    end;
+  writeln
+end.