.


:




:

































 

 

 

 


C . ң ө




ң : .in қ : 2
ғ ң : .out ғ : 64

N ұ 1- N - ң . N ұ ң N!=1*2*3**N. ѳң ң ң қ қғ ө . , N=3 ү ң қ қ : (1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1).
, (3, 1, 2) ң ө 5 .

ң . ң N (1 ≤ N ≤ 100000) ғ . N ү ң .

ғ ң . ғ ү ң ө ғң. ұ ө ү ү, қ ң 1000000007 (109+7)- ө қғ ғң.

. in . out
3 3 1 2  
4 2 3 1 4  

Turbo Pascal ғ:

program almastiru;
var n,i,j,s,m,k,c,t:integer;
a, b:array[1..1000] of integer;
f1,f2:text;
begin
assign(f1,.in); reset(f1);
assign(f2,.out); rewrite(f2);
readln(f1,n);
for i:=1 to n do read(f1,a[i]);
for i:=1 to n do b[i]:=i; s:=1;
for i:=n-1 downto 1 do
if b[i]<b[i+1] then begin
for j:=n downto i do if b[i]<b[j] then
begin
m:=b[i];
b[i]:=b[j];
b[j]:=m;
k:=1;
while i+k<n-k+1 do begin
m:=b[i+k];
b[i+k]:=b[n-k+1];
b[n-k+1]:=m;
k:=k+1;
end;
j:=i; end;
i:=n;
s:=s+1; c:=0;
for t:=1 to n do
if a[t]=b[t] then c:=c+1;
if c=n then writeln(f2,s);
end;
close(f1); close(f2); end.

 

A
N ұ . ң ң ү ң ң ө ғң.
ә
ң ү N (1 <= N <= 100000) . әқ 10^9- ң, ң ү N .
ә ғ
ң ғң.

/
A.in A.out
4
2 1 3 6 6 6*1=6

8-11
program mimax_A_zad;
var
a:array[1..100000] of longint;
max: longint;
i,min,n:integer;
label 10;

begin

write(Tizektegi elementter sany: ,n);read(n);
10: for i:=1 to n do
readln(a[i]); if a[i]>Power(10,9) then goto 10; {}

min:=a[1];
for i:=2 to n do
if a[i]<min then min:=a[i];
max:=a[1];
for i:=1 to n do
if a[i]>max then max:=a[i];

writeln(min element ,min);
writeln(max element ,max);
writeln(max,*,min,=,max*min);
end.
2-

PROGRAM Esep_1;
USES crt;
var A:array[1..10] of integer;
k,i,s,r:integer;
BEGIN
k:=0;
s:=0; r:=1;
for i:=1 to 10 do
begin
A[i]:=random(10);
if A[i] > k
then k:=A[i] end;
for i:=1 to 10 do
begin
if A[i] < k
then s:=A[i] end;
Writeln( =: ,s*k);
END.

 

 

B ө
ң N . ң ң ө ғң.
ә
ң ә ң N (1 <= N <= 10^100).
ә ғ
ң ғң.
/
B.in B.out
345 60 3*4*5=60
101 0 1*0*1=0

program CifKob_B_esep
var a,x:integer;
i,s:integer;

begin
writeln(san engiz );
readln(a); x:=a;
s:=1;
while (x<>0) do
begin
s:= s * (x mod 10);
x:= x div 10;
end;
writeln(Cifrlarynyn kobeitindisi ,a, = , s);
end.

 

ә !
S . қ ң қ ң. ә ң әқ ң ә 10^9- ө .
ә
ң ғ әң ә ұ S (1 <= S-ң ұғ <= 10^9).
ә ғ
ң ғң.

/
C.in C.out
1a5s123avdf11 140
1a5s123avdf11:1+5+123+11=140

var s,f:string;
n1,code1,i,k:byte;
summa:int64;

begin
assign(input,c.in); reset(input);
assign(output,c.out); rewrite(output);

read(f); f:=f+.; i:=1; summa:=0;

while i<=length(f) do
begin
val(f[i],n1,code1); s:=;
if code1=0 then
begin
s:=s+f[i]; inc(i); val(f[i],n1,code1);
while code1=0 do
begin
s:=s+f[i];
inc(i);
val(f[i],n1,code1);
end;
val(s,k,code1);
summa:=summa+k;
end
else inc(i);

end;

writeln(summa);
end.

 

D қ
ү A ә B . A- B-ғ қ ң қ ң.
ә
ң ү A ә B (1 <= A, B <= 10^9) .
ә ғ
ң ғң.
/
D.in D.out
1 5 9 1 + 3 + 5 = 9
2 6
8 3 + 5 = 8

var s:int64;
a,b,i:longint;

begin
assign(input,d.in); reset(input);
assign(output,d.out); rewrite(output);

s:=0;
read(a,b);
if odd(a) then i:=a else i:=a+1;
while i<=b do
begin
s:=s+i;
inc(i,2);
end;
writeln(s);
end.

 

E Ә ү
N ұ . Ә ү ң ң.
ә
ң ү N (1 <= N <= 1000000) . әқ 1000000- ң, ү N .
ә ғ
ң ғң.

/
E.in E.out
4
2 2 6 2 2 2,6
5
1 3 1 1 7 3
1,3,7

var n,i,j,k:longint;
a:array[1..1000000] of longint;
b:array[1..1000000] of boolean;

begin
assign(input,e.in); reset(input);
assign(output,e.out); rewrite(output);

readln(n); k:=0;
for i:=1 to n do begin read(a[i]); b[i]:=true; end;
for i:=1 to n do
if b[i]=true then
begin
inc(k);
b[i]:=false;
for j:=i+1 to n do if a[i]=a[j] then b[j]:=false;
end;
writeln(k);
end.

 

F ұ
ң ң . ңғ ә ң ғ қ ө .
S . ұғ ұ, , ң қ ққ. Ә ә ұ .
ә
ғң ғ ғ әң ә ұ S (1 <= S-ң ұғ <= 100000).
ә ғ
ң ғң.

/
F.in F.out
abaabaa 4
abaabaa, abaabaa, abaabaa, abaabaa
aaaa 4 aaaa, aaaa, aaaa, aaaa

 

var s:string;
i,k,j,n:longint;
procedure palindrom (s1:string);
var f1:boolean;
begin
f1:=true;
for j:=1 to length(s1) div 2 do if s1[j]<>s1[length(s1)-j+1] then f1:=false;
if f1 then k:=k+1;
end;

begin
assign(input,f.in); reset(input);
assign(output,f.out); rewrite(output);
readln(s); k:=0; n:=2;
while n<=length(s) do
begin
i:=1;
while i+n-1<=length(s) do
begin
palindrom(copy(s,i,n));
inc(i);
end;
inc(n,2);
end;
writeln(k);
end.

 





:


: 2017-01-21; !; : 2405 |


:

:

, , . , .
==> ...

1710 - | 1541 -


© 2015-2024 lektsii.org - -

: 0.011 .