- ө өң i ә j ң ?
- ғ ң ң ә қ? Қ ?
ғ
- NxM ө ң ә қғ ң ң ү ә ә ғғ ң ң .
- 7.2- ө ң:
7.2 ғ
ө ә ұ
ұ қ ң өң ғ ұң қ қ.
ұ қ: қ қ қ қ ғ.
ұ ө ұ қ қ. , 5, 8, 4, 9, 3 ұқ:
4.1- ө ұ
: | C/C++- : |
for j:=n downto 2 do for i:=1 to j-1 do if a[i]>a[i+1] then begin x:=a[i]; a[i]:= a[i+1]; a[i+1]:=x; end; | for (j=n; j>=2; j--) for (i=1; i<=j-1; i++) if (a[i]>a[i+1]) { x=a[i]; a[i]=a[i+1]; a[i+1]=x; } |
ұ ә қғ
. - қ . ң "<" ә ">" қ қ ( ә ).
: қ ұ , ә ұң .
var a: array [1..100] of integer; i,j,n,x:integer;begin writeln (' : '); readln (n); for i:= 1 to n do begin writeln ('a[',i,']='); readln (a[i]); end; {=====ұ==========} for j:=n downto 2 do for i:=1 to j-1 do if a[i]>a[i+1] then begin x:=a[i]; a[i]:= a[i+1]; a[i+1]:=x; end; for i:=1 to 5 do write(a[i]:3); writeln; j:=1; {====ә ұң ====} for i:=1 to (n div 2) do { ң қ қ} begin x:=a[j]; a[j]:= a[j+1]; a[j+1]:=x; j:=j+2; end; for i:=1 to n do write(a[i]:4);end.:
: | 5, 2, 1, 8, 0, 67, 100 |
ұғ: | 0, 1, 2, 5, 8, 67, 100 |
ә: | 0, 2, 1, 8, 5, 100, 67 |
2-. қ ң қ .
: қ ұ. ө өң: ң ғ ң , ғ ң ғ .
|
|
:
: | N=10 2, 1, 5, 3, 7, 8, 6, 12, 9, 11 |
ә: | 1, 2, 3 5, 6, 7, 8, 9 11, 12 |
3-. қ ң ң ұ , ғ .
: қ ұ. ө , өң: ң 1- ң , қ. k қ ң ұғ қ. ң қ, ң ұ қ.
var a: array [1..10] of integer; max,k,number,i,j,n,x: integer;begin writeln (' :'); readln (n); for i:= 1 to n do begin write('a[',i,']='); readln (a[i]); end; {===== ұ================} for j:=n downto 2 do for i:=1 to j-1 do if a[i]>a[i+1] then begin x:=a[i]; a[i]:= a[i+1]; a[i+1]:=x; end; {===ң ұ қ===} max:=0; k:=1; for i:=1 to n-1 do begin if a[i+1]-a[i]=1 then k:=k+1 else k:=1; if k>max then begin max:=k; number:=i+1; end; end; writeln('ң ұ ң =', max); writeln('ң ұ :'); for i:=(number-max+1) to number do write(a[i]:3);end.:
: | N=10 2, 1, 5, 3, 7, 8, 6, 12, 9, 11 |
ә: | Max=5 5, 6, 7, 8,9 |
4-: ө өң ғ ә ң ө .
: ө ө ө ң қ, ә ө . ң, ө ғ өң ұғ ұ.
var b:array[1..10] of string; a,a1,a2,x: string; n,i,j,k: integer;begin writeln ('ө :'); readln (a); n:=length (a); k:=0; for i:=1 to n do if copy(a,i,1)=' ' then k:=k+1; k:=k+1; j:=1; for i:=1 to n do if copy(a,i,1)=' ' then j:=j+1 else b[j]:=b[j]+copy(a,i,1); {===== ұ ==============} for j:=k downto 2 do for i:=1 to j-1 do if length (b[i])>length (b[i+1]) then begin x:=b[i]; b[i]:= b[i+1]; b[i+1]:=x; end; { ==============================} for i:=1 to k do writeln (b[i]);end.:
: | ң ү ә - |
ә: | - ң ә ү |
ұ ң ң ө ө ә ө ұ қ .
|
|
. ө ұ . ң ә (4.2-). ң ң ө ұ, ө қ .
4.2
:
Қ ә ғ ң (4.3-):
4.3
ң өңң қ қ, A ң ң ң қ. ұ ң ғ ө қғ .
const m=10;var a, b: array [1..m] of integer; i, j, n, x, k: integer;begin writeln(' :'); readln(n); for i:=1 to n do begin write('a[',i,']='); readln(a[i]); end; j:=1; k:=0; for i:=1 to n do if a[i]>0 then begin b[j]:=i; j:=j+1; k:=k+1; end; for j:=k downto 2 do for i:=1 to j-1 do if a[b[i]]>a[b[i+1]] then begin x:=a[b[i]]; a[b[i]]:=a[b[i+1]]; a[b[i+1]]:=x; end; for i:=1 to n do write (a[i],' ');end.:
: | N=9 -3, 5, -1, 3, 6, -8, 2, -1, -3 |
ә: | -3, 2, -1, 3, 5, -8, 6, -1, -3 |
ұң ө ә ө ғ : ү ң ғ , ң . ң ң ү ң ң ң . Ә қ ңғ қ.
ң ө ұ (ұң ө ң) ұ ә қ ( ң ң қ қ).
ұқ.
ө ұң қ ?
ө ұ ә ң қ ң ә қң?
ә ә ұ. ң әқ ө қ , ә ә .
ұ , ғ ө , құ ұ .
ө ә ө , .
ө өң ә (ә ө ә ) қ.