level 1
寒意的含义
楼主
var
a,b,c:array[1..10000] of longint;
m,n,s,t,i,p:longint;
begin
readln(m,n);
for i:=1 to m do read(a[i]);
readln;
for i:=1 to n do read(b[i]);
readln;
p:=0;s:=1;t:=1;
repeat
inc(p);
if a[s]<b[t] then
begin
c[t]:=a[s];
inc(s);
end;
else
begin
c[p]:=b[t];
inc(t);
end;
until (s=m+1)or(t=n+1);
if m<n then
for i:=p to n-t do
begin
c[i]:=b[t];
inc(t);
end;
else
for i:=p to m-s do
begin
c[i]:=a[s];
inc(s);
end;
for i:=1 to n+m do
write(c[i],' ');
end.
编译显示(18,4):Syntax error,"UNTIL"expected but "ELSE" found
是格式错误吗?
题目就是合并有序数列
2016年04月16日 14点04分
1
a,b,c:array[1..10000] of longint;
m,n,s,t,i,p:longint;
begin
readln(m,n);
for i:=1 to m do read(a[i]);
readln;
for i:=1 to n do read(b[i]);
readln;
p:=0;s:=1;t:=1;
repeat
inc(p);
if a[s]<b[t] then
begin
c[t]:=a[s];
inc(s);
end;
else
begin
c[p]:=b[t];
inc(t);
end;
until (s=m+1)or(t=n+1);
if m<n then
for i:=p to n-t do
begin
c[i]:=b[t];
inc(t);
end;
else
for i:=p to m-s do
begin
c[i]:=a[s];
inc(s);
end;
for i:=1 to n+m do
write(c[i],' ');
end.
编译显示(18,4):Syntax error,"UNTIL"expected but "ELSE" found
是格式错误吗?
题目就是合并有序数列