Задача A-Цифри
var
f,f1:text;
k,m,i:byte;
a:longint;
d:array[1..10] of byte;
b:boolean;
begin
assign(f,'z1.dat'); reset(f);
assign(f1,'z1.sol'); rewrite(f1);
readln(f,k); b:=false;
while not eof(f) do begin
readln(f,a);
m:=0;
if (a<0) then a:=-a;
if (a=0) then begin m:=1; d[1]:=0; end;
while a<>0 do begin
m:=m+1;
d[m]:=a mod 10;
a:=a div 10;
end;
if (m=k) then begin
b:=true;
for i:=k downto 1 do
write(f1, d[i], ' ');
writeln(f1);
end;
end;
if (b=false) then writeln(f1, 'no solution');
close(f1);
end.
Задача B-Послідовність
var
f,f1 : text;
x,i:longint;
a:array[1..10000] of byte;
begin
assign(f,'z2.dat'); assign(f1,'z2.sol'); rewrite(f1);
reset(f);
while not eof(f) do
begin
readln(f,x);
if (x>=1) and (x<=10000) then a[x]:=1;
end;
i:=1;
while (i<10000) and (a[i] = 1) do i:=i+1;
if a[i]=0 then writeln(f1,i) else writeln(f1,10001);
close(f);close(f1)
end.
Задача C-Текст
var
f,f1 : text;
c:char;
i:integer;
sl:string;
begin
assign(f,'z3.dat');assign(f1,'z3.sol');
reset(f);rewrite(f1);
read(f,c);
while not eof(f) do
begin
while not (c in ['a'..'z']) and not eof(f) do
begin
if c=#10 then writeln(f1);
read(f,c)
end;
sl:='';
while (c in ['a'..'z']) and not eof(f) do
begin sl:=sl+c; read(f,c) end;
if (c in ['a'..'z']) and eof(f) then sl:=sl+c;
if length(sl)>1 then write(f1,sl,' ');
end;
close(f); close(f1);
end.