195 lines
1.6 KiB
Plaintext
195 lines
1.6 KiB
Plaintext
1 2 program
|
|
1 23 bubble
|
|
2 5 var
|
|
2 21 integer
|
|
2 23 i
|
|
2 38 ,
|
|
2 23 j
|
|
2 38 ,
|
|
2 23 num
|
|
2 37 ;
|
|
3 17 array
|
|
3 39 [
|
|
3 24 1
|
|
3 41 ..
|
|
3 24 20
|
|
3 40 ]
|
|
3 18 of
|
|
3 21 integer
|
|
3 23 a
|
|
3 37 ;
|
|
5 3 procedure
|
|
5 23 q
|
|
5 33 (
|
|
5 21 integer
|
|
5 23 num
|
|
5 34 )
|
|
5 37 ;
|
|
7 5 var
|
|
7 21 integer
|
|
7 23 i
|
|
7 38 ,
|
|
7 23 j
|
|
7 38 ,
|
|
7 23 k
|
|
7 37 ;
|
|
8 21 integer
|
|
8 23 t
|
|
8 37 ;
|
|
9 13 begin
|
|
10 23 i
|
|
10 26 :=
|
|
10 24 1
|
|
10 37 ;
|
|
11 10 while
|
|
11 23 i
|
|
11 28 <
|
|
11 23 num
|
|
11 11 do
|
|
12 23 j
|
|
12 26 :=
|
|
12 23 num
|
|
12 30 -
|
|
12 23 i
|
|
12 29 +
|
|
12 24 1
|
|
12 37 ;
|
|
13 23 k
|
|
13 26 :=
|
|
13 24 1
|
|
13 37 ;
|
|
14 10 while
|
|
14 23 k
|
|
14 28 <
|
|
14 23 j
|
|
14 11 do
|
|
15 6 if
|
|
15 23 a
|
|
15 39 [
|
|
15 23 k
|
|
15 29 +
|
|
15 24 1
|
|
15 40 ]
|
|
15 28 <
|
|
15 23 a
|
|
15 39 [
|
|
15 23 k
|
|
15 40 ]
|
|
16 7 then
|
|
17 23 t
|
|
17 26 :=
|
|
17 23 a
|
|
17 39 [
|
|
17 23 k
|
|
17 40 ]
|
|
17 37 ;
|
|
18 23 a
|
|
18 39 [
|
|
18 23 k
|
|
18 40 ]
|
|
18 26 :=
|
|
18 23 a
|
|
18 39 [
|
|
18 23 k
|
|
18 29 +
|
|
18 24 1
|
|
18 40 ]
|
|
18 37 ;
|
|
19 23 a
|
|
19 39 [
|
|
19 23 k
|
|
19 29 +
|
|
19 24 1
|
|
19 40 ]
|
|
19 26 :=
|
|
19 23 t
|
|
20 8 else
|
|
20 23 t
|
|
20 26 :=
|
|
20 24 0
|
|
21 9 fi
|
|
21 37 ;
|
|
22 23 k
|
|
22 26 :=
|
|
22 23 k
|
|
22 29 +
|
|
22 24 1
|
|
23 12 endwh
|
|
23 37 ;
|
|
24 23 i
|
|
24 26 :=
|
|
24 23 i
|
|
24 29 +
|
|
24 24 1
|
|
25 12 endwh
|
|
26 14 end
|
|
28 13 begin
|
|
29 15 read
|
|
29 33 (
|
|
29 23 num
|
|
29 34 )
|
|
29 37 ;
|
|
30 23 i
|
|
30 26 :=
|
|
30 24 1
|
|
30 37 ;
|
|
31 10 while
|
|
31 23 i
|
|
31 28 <
|
|
31 23 num
|
|
31 11 do
|
|
32 15 read
|
|
32 33 (
|
|
32 23 j
|
|
32 34 )
|
|
32 37 ;
|
|
33 23 a
|
|
33 39 [
|
|
33 23 i
|
|
33 40 ]
|
|
33 26 :=
|
|
33 23 j
|
|
33 37 ;
|
|
34 23 i
|
|
34 26 :=
|
|
34 23 i
|
|
34 29 +
|
|
34 24 1
|
|
35 12 endwh
|
|
35 37 ;
|
|
36 23 i
|
|
36 33 (
|
|
36 23 num
|
|
36 34 )
|
|
36 37 ;
|
|
37 23 i
|
|
37 26 :=
|
|
37 24 1
|
|
37 37 ;
|
|
38 10 while
|
|
38 23 i
|
|
38 28 <
|
|
38 33 (
|
|
38 23 num
|
|
38 29 +
|
|
38 24 1
|
|
38 34 )
|
|
38 11 do
|
|
39 16 write
|
|
39 33 (
|
|
39 23 a
|
|
39 39 [
|
|
39 23 i
|
|
39 40 ]
|
|
39 34 )
|
|
39 37 ;
|
|
40 23 i
|
|
40 26 :=
|
|
40 23 i
|
|
40 29 +
|
|
40 24 1
|
|
41 12 endwh
|
|
42 14 end
|
|
42 35 .
|
|
42 0 ÿ
|