Вы находитесь на странице: 1из 4

17.

-


.
.
, , 0 256 (,
, ).
.
,
,
.
, .
.
:
type
DigitChar = set of '0'..'9';
Digit

= set of 0..9;

var
s1,s2,s3: DigitChar;
s4,s5,s6: Digit;
...
s1:=['1','2','3'];
s2:=['3','2','1'];
s1:=['2','3'];
s1:=[0..3,6];
s1:=[4,5];
s1:=[3..9];
...

121

s1 s2 , s3
s2, .

< > = set of < >;

< > ;
set, of (, );
< > ,
, Word, Integer, Longint.

: ,


, - .

:
* ; ,
. , s4*s6 [3], s4*s5 .
+ ;
:
s4+s5 [0,1,2,3,4,5,6];
s5+s6 [3,4,5,6,7,8,9];
- ;
, :
s6-s5 [3,6,7,8,9];
s4-s5 [0,1,2,3,6];
= ; true,
.
<> ; true,
.
122

<= ; true,
.
>= ; true,
.
in ;
, ; true,
, :
3 in s6 true;
2*2 in s1 false;


. (
3) ,
. ,
3.
{ N }
const
N = 100;

{ }

type
SetOfNumber = set of 1..N:
var
n1,next,i : word;

{ }

BeginSet,

{ }

PrimerSet : SetOfNumber;

{ } BEGIN

BeginSet := [2..N];

{ }

PrimerSet := [1];

{ }

Next := 2;

{ }

while BeginSet <> [] do

{ }

begin
n1:= next;

{n1-,
(next)}

123

while n1 <- N do

{
:}

begin
BeginSet := BeginSet-[n1];
n1 :=n1+next;
end;

{ }
{ }

PrimerSet := PrimerSet+[next];
repeat

{ ,
}

inc(next)
until (next In BeginSet) or (next > N)
end;

{ )

{ : }
for i := 1 to N do
if I in PrimerSet then write(i:8);
writeln;
END.

124

Вам также может понравиться