7
: .
: () . .
: ;
̲: ;
: : , : Turbo Pascal 6.0.
ʲ Ͳ ²Ҳ
(Set) , ᒺ, . ᒺ . , . . . , . N , 2N .
Set of ( ).
:
Type
< > = Set of < >;
Var
< >: < >;
:
Var
< >: Set of < >;
.
Type
SetChar = Set of Char; { }
SetByte = Set of Byte; { }
SetDigit = Set of 0..9; { 0 9}
SetDChar = Set of '0'..'9'; { '0', '1',,'9'}
SetSpring = Set of (March, April, May); { , };
SetGolosn = Set of ('', '', '', '', '', '', ''); { }
, , 256 . Byte (0..255) i Char, , . . Byte , Char ASCII. 0 255. ShortInt(128..127), Word(0..65535), Integer(32768..32767), LongInt(2147483648..2147483647).
. .
.
SByte:= [1,2,3,4,10,20,30,40];
SChar:= ['a', 'b', 'c'];
SChar:= [ 'd'];
SSpring:= [April];
SDiap:= [1..4]; { , [1,2,3,4]}
SComp:= [1..4, 5,7,10..20];
Empty:= [];
[].
, . .
|
|
, ['a','b','b','a'] i ['a','b'] .
, | |||
= | S1 = S2 | , TRUE, S1 S2 , FALSE . [1,2,3] = [1,3,2]; [] = []; ['a'..'c'] = ['a','b','c'] | |
<> | S1<>S2 | , TRUE, S1 S2 , FALSE . [1,2] <> [1]; [] <> [3]; ['a'..'c'] <> ['a','c'] | |
<= | S1<=S2 | , TRUE, S1 S2 , FALSE . ['a','b'] <= ['a'..'z']; [] <= [4]; [1,2] <= [1,2,3] | |
>= | S1>=S2 | , TRUE, S2 S1, FALSE . ['x'..'z'] >=['y']; [1..10] >=[1..5]; [5,7] >=[] | |
in | E in [] E in S1 | , TRUE, [] (S1). , FALSE. 5 in [0..5]; 's' in ['a'..'z']; not (7 in [9..20]) | |
+ | ᒺ | S1 + S2 | ᒺ , , . [1,2]+[2,3,4] = [1,2,3,4]; {[1..4]} ['s'] + [] = ['s'] |
г | S1 S2 | S1 S2 , , S1, S2. [5,7,9] [7] = [5,9]; ['1','2'] ['8','9'] = ['1','2'] | |
* | S1 * S2 | , S1 S2, S1, S2. [3,4,5,6,7] * [4,5,8] = [4,5]; ['x'] * [] = [] |
: ; ; . , . .
.
1. 1..4900, n2 + 2k2, 7ij + j + 3 (n, k, i, j ≥ 0).
Uses Crt;
Type S = 1..4900;
SS = Set of S;
Var p: S;
S1, S2: SS;
n, k: integer;
Begin
S1:=[]; S2:=[]; { }
for n:= 0 to 70 do
for k:= n to 70 do
begin
S1:= S1 +[n*n +2*k*k];
S2:= S2 + [7*n*k + k + 3]
end;
for p:= 4900 downto 1 do
if (p in S1) and (not (p in S2))
then writeln(p)
End.
2. , . , . (, qqwerrtyy., qwerty).
|
|
Uses Crt;
Var Let: Set of 'a'..'z';
ch: Char;
Begin
ClrScr;
Let:= []; { }
Read(ch);
while ch <> '.' do
begin
if not (ch in Let) then { }
begin
Write(ch);
Let:= Let + [ch]
end;
Read(ch)
end
End.
Ҳ ϲ ί
1. , , , ( .).
2. .
3. .
:
1. .
2. Turbo Pascal.