270102 , 270115 , 280201 , 270100 , 280200 .
. : , , , , , .
, , , , , .
, . . .
- , .
:
1. .
2. .
3. - .
4. .
5. , .
6. .
. , , :
.
.
:
- ;
- .
.
.
.
.
.
, , .
1
: Borland Pascal, , , , , .
|
|
, . , , .
, . / ([1], . 10-28).
. M1(x1,y1) M2(x2,y2).
.
.
: M1(x1,y1) M2(x2,y2) :
, " " " " (.1):
. 1
. - , , :
program example1;var x1, x2, y1, y2: Integer; d:Real; begin Writeln(' '); Writeln(' :'); Write('x1= '); Readln(x1); Write('y1= '); Readln(y1); Write('x2= '); Readln(x2); Write('y2 ='); Readln(y2); d:=sqrt(sqr(x2-x1)+sqr(y2-y1)); Writeln('d= ',d:6:2); Writeln(' Enter '); Readln; end.
:
x1 | y1 | x2 | y2 | ||
-4 | 5.00 | ||||
0.00 | |||||
5,83095 | 5.83 | ||||
-23 | -4 | 19,41649 | 19.42 |
, , .
1-2.
1. x, y. :
1. | 4. | 7. | 10. | ||||
2. | 5. | 8. | 11. | ||||
3. | 6. | 9. | 12. |
2. :
1. . .
2. R1, R2, R3 . .
3. h.
4. . , .
5. . .
6. , , a, b, c.
7. r h.
8. , t, V0.
9. , .
10. y=ax2+bx+c (a ≠0). a, b, c .
11. , .
|
|
12. . .
3. true, , false ( , , ):
1) x [ -a, a ];
2) x ;
3) x (a, b);
4) x ;
5) x 9;
6) x ;
7) x, y - ;
8) ;
9) x 0.5;
10) x K;
11) x : ax+b=0;
12) .
1. , h1 min1 , , h2 min2 . , , . , .
2. . , , : ) 4 ; ) 6 ; ) 7 ; ) 8 .
3. , .
1. Borland Pascal?
2. ?
3. ?
4. ?
5. ?
6. ?
7. ?
2
: ; if case.
, , . .
, , if, case. . [1], c. 28-35.
. x. f, , f(x).
.
: :
, (. 2).
. .
Program example1; var x, f:Real; begin Write(' x: '); Readln(x); if x<-1 then f:= -x-1 else if (x>=-1) and (x<0) then f:= x-1 else if (x>=0) and (x<1) then f:= -x+1 else f:= x+1; Writeln('F= ',f:6:2); Readln; end.. 2
1. if, Integer:
1) 7)
2) 8)
3) 9)
4) 10)
5) 11)
6) 12)
2.
1. , : 7 ; : 14. : : ? (1/0) (1 , 0 ).
2. , : , , ( (-1), 0, 1), , .
|
|
3. , : . ( , 4, , 100 400, : 1900 , 2000 ).
4. , , : , , 5, . , .
5. . : 0 50 , . 10% - , . , .
6. . 0 9. , . ( ), .
7. , , t -. . , , , 7 /.
8. . , . t . - 40 . , . - .
9. - 0 100 ( ). . , . , , , . . , .
10. . 3, , 10 . . 0 10. 5 , 5 .
11. N . , , 20% , - 20 50%, 50%. , M .
12. . 3 . 3 2 . 2 3 . . : 0, 10, 5.
3. , .
1. N- .
2. , .
3. N- .
4. , .
5. .
6. 09. (0 "", 1 "", 2 "",...).
|
|
7. 15. (1 "", 2 "", 3 "", 4 "", 5 "").
8. 1 10 .
9. : 1 , 2 , 3 , 4 . A B ( ). .
10. : 1 , 2 , 3 , 4 . M (M - ). .
11. 199, ( ). - : , , , , .
12. , 12 : , , , , , , , , , , , . , .
1. a, b, c, x, y. , a,b,c x y. , .
2. R P Q?
3. , , : ) ; ) ; ) ; ) .
4. 60- , 12- , : , , , . : , , , , , , , , , , . , 1984 .
1. ?
2. ?
3. : Sin(x), Abs(x), Trunc(x) if x<0 then x:= -x?
3
: Borland Pascal, .
, .
for, while, repeat ( . [1], c. 35-42).
, .
: 1 M . n , , n, . , 153 (153=13+53+33).
. i ( 1 ) . n, s i. i s , i , .
PROGRAM Primer_1;
var i,k,s,p,n,M: Integer;
begin
Write(' M '); Readln(M);
for i:=1 to M do
begin
s:=0; k:=i; n:=0;
while k<>0 do
begin k:=k div 10; n:=n+1 end;
k:=i;
While k<>0 do
begin p:=k mod 10; k:=k div 10;
if p<>0 then s:=s+ Round(Exp(n*Ln(p)))
end;
if s=i then Writeln(i);
end;
Readln;
end.
1. , :
1. , 2, 13.
2. , 1000, .
3. , 3 4.
|
|
4. , .
5. , 2, 3.
6. , 3, 4.
7. , 3 7.
8. , 7 3.
9. , 2, 3.
10. , 2.
11. , 1000, 25 3.
12. , x, 10 5.
. , 1 : 10 99, 100 999 ..
2. , .
1. . b ? 3%.
2. 15%. . . , ?
3. N 3% . 40 000 . , x .
4. . A . , X?
5. , , 8 . .
6. 5, 9, 13, 17, 21, . , , , , x.
7. - 20 % , . , x, 12 .
8. . , X , .
9. 1, 2, 3, 4, , S. S , .
10. , -, t ( ) ( ).
11. n, 1/ k k 1 n , 10 .
12. , a /. V /. , V?
1. for?
2. for?
3. while repeat?
4. ?
5. ?
6. , .
7. , .
8. ?
9. ?
10. " repeat A until B " while.
4
: - .
, .
(. [1, c. 42-66]).
1. f(x)=2 cos x+3, x ϵ{1; 4; 7,5; 20}. : - x, - f(x). : .
. , Real. . , - - fx. , .
program proc_1;
function f(x:Real):Real;
begin
f:=2*cos(x)+3
end;
procedure proc_f(x:Real;var fx:real);
begin
fx:=2*cos(x)+3
end;
var x,fx:real;
begin
Writeln(' :');
Writeln(' x f(x)');
x:=1; proc_f(x,fx); Writeln(x:6:2, fx:6:2);
x:=4; proc_f(x,fx); Writeln(x:6:2, fx:6:2);
x:=7.5; proc_f(x,fx); Writeln(x:6:2, fx:6:2);
x:=20; proc_f(x,fx); Writeln(x:6:2, fx:6:2);
Readln;
Writeln(' :');
Writeln(' x f(x)');
Writeln(1:6, f(1):6:2);
Writeln(4:6, f(4):6:2);
Writeln(7.5:6:2, f(7.5):6:2);
Writeln(20:6, f(20):6:2);
Readln;
end.
2. n- , : A1=1, A2=3, Ai=3Ai-2-Ai-1. 1 10 .
. , - Integer. ( i =1, i =2), case. if, . - , - for.
program proc_2;
function A(i:Integer):Integer;
begin
if i=1 then A:=1 else
if i=2 then A:=3 else :=3*A(i-2)-A(i-1)
end;
var i:Integer;
begin
for i:=1 to 10 do Write(A(i),' ');
Readln
end.
1. .
1. (x1,y1), (x2,y2), (x3,y3). , . :
.
2. . , :
3. 0,1; 0,2; 0,3; 0,4; 0,5; 0,6; 0,7; 0,8; 0,9; 1,0 . , :
, g =9,8.
4. , . , . : V=πR2H, R , H .
5. . n . n ϵ{2,4,6,8,10}.
6. , f(x) x. : - x, - f(x).
7. l1 l2. , P , :
, g=9,8, l .
8. . , S=πR2. :
,
9. , , , .
10. . , E1, E2, E3 . . , , .
11. : P S1 , S2 / (S1, S2, P - ). , .
12. p1, p2 . S . P , .
2. 1, .
3. 1 10 . :
1. , : Di=7+Di-1 i>1. .
2. : an=aan-1.
3. , : Ai=Ai-1-Ai-2, i>2. i, .
4. : an=an-1+d, n >0. n, d a0 .
5. cos(cos(cos...cos(cos(cos x)))),
cos n . x n .
6. , :
y1=0; y2=10; yn=2×yn-1-yn-2, n>2.
7. , Bi=4Bi-1, i>1. i .
8.
bi=bi-1 q, i, q b0 .
9. sin(sin(sin...sin(sin(sin x)))), sin n . x n .
10. , :
11. , , i >1. i .
12. , :
x1=1; xn=xn-1+n+3, n≥2.
1. a, b, c min(a,ab)+min(a,ac)+1 .
2. , , . , :
3. . , , .
1. ?
2. ?
3. .
4. -?
5. , ?
6. ?
5
: .
, .
([1], . 67-73).
1. , , N , .
. , , . - . i s . s. , , , s. s .
program massiv_1;
const N=10;
type mas=array [1..N] of Real;
procedure Vvodmas(var A:mas);
var i:Integer;
begin
for i:=1 to N do A[i]:=-50+Random(101)+random;
end;
procedure Vivodmas(A:mas);
var i:Integer;
begin
for i:=1 to N do Write(A[i]:8:2);
Writeln
end;
function Summa(A:mas):real;
var i: Integer; s:real;
begin
s:=0;
for i:=1 to N do if A[i]>0 then s:=s+A[i];
Summa:=s;
end;
var A: mas;
begin
Randomize; Vvodmas(A);
Writeln(' :'); Vivodmas(A);
Writeln(': ', Summa(A):0:2);
Readln
end.
2. . , , (a, b) .
. , - j, i.
n1 n2, p.
, max, . ( max. , .)
, , (a, b), .
const n=10; m=7;
type mas=array [1..n,1..m] of Integer;
procedure Vvodmas(var D:mas);
var i,j:Integer;
begin
for i:=1 to n do
for j:=1 to m do
D[i,j]:=-50+Random(101);
end;
procedure Vivodmas(D:mas);
var i,j:Integer;
begin
for i:=1 to n do
begin
for j:=1 to m do Write(D[i,j]:4);
Writeln;
end;
end;
procedure Obmen(a,b: real; var D:mas);
var i,j,p,n1,n2,max: Integer;
begin
for j:=1 to m do
begin
n1:=1; max:=abs(D[1,j]);{ }
for i:=2 to n do
if abs(D[i,j])>max then { }
begin n1:=i; max:=abs(D[i,j]) end;
i:=n; { , }
while (i>=1)and (D[i,j]>a)and(D[i,j]<b) do i:=i-1;
n2:=i;
if n2<>0 then { , (a,b), }
begin
p:=D[n1,j]; D[n1,j]:=D[n2,j]; D[n2,j]:=p; { }
end;
end;
end;
var D: mas; a,b:Real;
begin
Randomize; Vvodmas(D);
Writeln(' :'); Vivodmas(D);
Write(' (a,b): '); Readln(a,b);
Obmen(a,b,D);
Writeln(':'); Vivodmas(D);
Readln
end.
1. , , N , :
1) ;
2) ;
3) , (a, b);
4) , ;
5) , [ a, b ];
6) , ;
7) , X;
8) ;
9) , X;
10) , X;
11) , (a, b);
12) , [ a, b ];
2. . , , :
1) X [ a, b ] ;
2) (a, b) ;
3) ;
4) ;
5) ;
6) K , K - ;
7) ;
8) ;
9) (a, b) ;
10) [ a, b ] ;
11) ;
12) .
1. .
2. , .
3. , .
4. . M .
5. . , , . ( 31 , 30).
6. A N N . , A [1,1] A [ N,N ]. , .
7. . , , , .
8. .
9. , , .
10. , , - , . . , .
1. ?
2. ?
3. ?
4. , : var A: array [1..3, 20..24] of real.
5. .
6