发布网友 发布时间:2024-10-27 22:32
共1个回答
热心网友 时间:2024-10-27 22:58
应该是这样,不对在说
program fsd;
var
a,b:array[1..100] of integer;
n,i,x,y,t,j,k:integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
read(x,y);
t:=1;
for j:=1 to n do begin
k:=j;
if a[j]=x then while k<=n do if a[k]<>y then begin
b[t]:=a[k];
inc(t);
inc(k);
end else begin b[t]:=a[k];inc(t);break;end;
end;
read(x,y);
for j:=1 to n do begin
k:=j;
if a[j]=x then while k<=n do if a[k]<>y then begin
b[t]:=a[k];
inc(t);
inc(k);
end else begin b[t]:=a[k];inc(t);break;end;
end;
for i:=1 to t-1 do write(b[i],' ');
end.