Задача 1 (NICE.PAS) {$B-} program Simple_Nice_Numbers; var i, n, m,t: LongInt; f: Text; function Simple(r: LongInt): Boolean; var j: LongInt; begin Simple:=True; if r mod 2 = 0 Then begin Simple:=False;Exit;end; j:=3;t:=Round(Sqrt(r)); While j<=t do begin if r mod j = 0 then begin Simple:=False;Exit;end; j:=j+2; end; end; function Nice(r: LongInt): Boolean; var ii: Byte; s: String; Res: Boolean; begin Str(r, s);Res:=True; for ii:=1 to Length(s) do Res:=Res and (s[ii] in ['1', '3', '5', '7', '9']); Nice:=Res; end; BEGIN Assign(f, 'Nice5.dat'); ReSet(f); Read(f, m, n); Close(f); if n mod 2 = 0 then n:=n-1; if m mod 2 = 0 then m:=m+1; Assign(f, 'Nice.sol'); ReWrite(f); i:=m; while i <= n do begin if Nice(i) then if Simple(i) then WriteLn(f, i); i:=i+2; end; Close(f); END. Задача 2 (BILLIARD.PAS) Type TPoint=Record x, y: Real; end; Var a, b, c, o, o1, o2, o3, res: TPoint; ra1, ra2, rb1, rb2, rc1, rc2: Real; f: Text; Procedure Cross (s, a1, b1:TPoint; var cross:TPoint); var k, k1, b, b2: Real; mid: TPoint; begin if a1.x=b1.x then begin cross.x:=2*a1.x-s.x; cross.y:=s.y; end else if a1.y=b1.y then begin cross.x:=s.x; cross.y:=2*a1.y-s.y; end else begin k:=(a1.y-b1.y)/(a1.x-b1.x); k1:=-1/k; b:=(a1.x*b1.y-a1.y*b1.x)/(a1.x-b1.x); b2:=s.y-k1*s.x; mid.x:=(b2-b)/(k-k1); mid.y:=k*mid.x+b; cross.x:=2*mid.x-s.x; cross.y:=2*mid.y-s.y; end; end; BEGIN Assign (f, 'billiard.dat'); Reset (f); Readln (f, a.x, a.y); Readln (f, b.x, b.y); Readln (f, c.x, c.y); Readln (f, o.x, o.y); Close (f); cross(o,a,c,o1); cross(o1,b,c,o2); cross(o2,a,b,o3); ra1:=b.y-a.y; rb1:=a.x-b.x; ra2:=o3.y-o.y; rb2:=o.x-o3.x; rc1:=a.x*(b.y-a.y)+a.y*(a.x-b.x); rc2:=o.x*(o3.y-o.y)+o.y*(o.x-o3.x); res.x:=(rc1*rb2-rc2*rb1)/(ra1*rb2-ra2*rb1); res.y:=(ra1*rc2-ra2*rc1)/(ra1*rb2-ra2*rb1); Assign (f, 'billiard.sol'); Rewrite(f); Write (f,res.x:5:2,' ',res.y:5:2); Close (f); END. Задача 3 (MAX.PAS) Var s,t, tmax: String; i,j,code:Integer; num,max:Real; f:Text; BEGIN Assign (f,'max1.dat'); Reset (f); Readln(f,s); Close(f); t:=''; For i:=1 To Length(s) Do Begin If (s[i]>='0') And (s[i]<='9') Then Begin t:=t+s[i]; j:=i+1; While (j<=Length(s)) And (s[j]>='0') And (s[j]<='9') Do Begin t:=t+s[j]; Inc(j); End; If s[j]='.' Then Begin t:=t+s[j]; Inc(j); While (j<=Length(s)) And (s[j]>='0') And (s[j]<='9') Do Begin t:=t+s[j]; Inc(j); End; End; Val (t,num,code); If num>max Then Begin max:=num; tmax:=t; End; t:=''; End; End; i:=1; While tmax[i]='0' Do Delete (tmax,i,1); Assign (f,'max.sol'); Rewrite(f); Writeln(f,tmax); Close(f); END.