program summ;
uses crt;
var a,i,x0:integer;
var ans:real;
begin
clrscr;
writeln ('a=');
readln (a);
writeln ('x0=');
readln (x0);
ans:=0;
if abs(a)>10 then writeln ('neverno') else
for i:=a downto 0 do
begin
readln(a);
writeln ('a',i,'=');
ans:=ans*x0+a;
end;
writeln ('summ=',ans);
readln;
end.

program arrrr;
uses crt;
var a,n,i,max,num:integer;
begin
clrscr;
writeln ('n=');
readln (n);
writeln ('a=');
readln (a);
max:=a;
num:=1;
if n=1 then writeln ('num',n) else
for i:=2 to n do
begin
write ('a',i,'= ');
readln (a);
if max<=a then
begin
max:=a;
num:=i;
end;
end;
writeln ('num=',num);
readln;
end.

program zadaca4;
uses crt;
var a,b,c,d,e,f:integer;
var x,y,z,l:real;
begin
writeln('a=');
readln(a);
writeln('b=');
readln(b);
writeln('c=');
readln(c);
writeln('d=');
readln(d);
writeln('e=');
readln(e);
writeln('f=');
readln(f);
x:=sqr(c-a)+sqr(d-b);
y:=sqr(e-a)+sqr(f-b);
z:=sqr(f-d)+sqr(e-c);
l:=x;
if lx+y+z then writeln ('5') else
if (f=(((e-a)*(d-b))/(c-a))+b) then writeln ('2') else
if (b=(((a-d)*(f-c))/(e-c))+d) then writeln ('2') else
if (f=(((c-a)*(f-b))/(e-a))+b) then writeln ('2');
readln;
end.

program 5;
users crt;
var x,y:integer;
begin
clrscr;
writeln ('x=');
readln (x);
writeln('y=');
readln (y);
if(x>0) and (y>0) then writeln ('1') else
if(x<0) and (y>0) then writeln ('2') else
if(x<0) and (y<0) then writeln ('3') else
if(x>0) and (y<0) then writeln ('4') else
if(x=0) then writeln ('®бм y') else
if(y=0) then writeln ('®бм x') else
writeln ('na4alo koordinat');
readln
end.

uses crt;
type direction = (north, east, south, west);
curs = (forwrd,left,right,back);
var k1,k2: direction;
p: curs;
n: integer;
begin
clrscr;
write('Kyda nJlblBem?','(0-north, 1-east, 2-south, 3-west) =>');
readln(n);
k1:=direction(n);
write('Kyda cka3aJlu nJlblTb?','(0-np9mo, 1-HaJleBo, 2-HanpaBo, 3-Ha3ad) =>');
readln(n);
p:=curs(n);
case k1 of
north: case p of
forwrd: K2:=north;
back: K2:=south;
left: K2:=west;
right: K2:=east;
end;
east: case p of
forwrd: K2:=east;
back: K2:=west;
left: K2:=north;
right: K2:=south;
end;
south: case p of
forwrd: K2:=south;
back: K2:=north;
left: K2:=east;
right: K2:=west;
end;
west: case p of
forwrd: K2:=west;
back: K2:=east;
left: K2:=south;
right: K2:=north;
end;end;
writeln ('HoBblu kypc ',ord(k2));
if ord(k2)=0 then writeln('CEBEP! MEgBEgU, Mbl k BAM! :)') else
if ord(k2)=1 then writeln('BOCTOK - DeJlo ToHkoe! :)') else
if ord(k2)=2 then writeln('lOr, CO4U, Mbl EDEM! :)') else
if ord(k2)=3 then writeln('3anag. Dukuu 3anag! :)');
readln;
end.

uses crt;
const n=100;
var a:array[1..n] of integer;
i,r:integer;
begin
clrscr;
writeln('MACCUB:');
for i:=1 to n do
begin
a[i]:=random(100);
write(a[i],' ');
end;
writeln;
r:=a[n];
for i:=n downto 2 do
a[i]:=a[i-1];
a[1]:=r;
writeln;
writeln('MACCUB+1:');
for i:=1 to n do
write(a[i],' ');
readln;
end.

program Bpem9;
uses crt;
var a:integer;
begin
clrscr;
writeln('Bpem9?');
readln(a);
write('npowJlo ',a div 3600, ' 4acoB ', (a div 60 mod 60),'muHyT ');
readln;
end.

program N or M;
uses crt;
var m,n:integer;
begin
clrscr;
writeln('4ucJlo m?');
readln(m);
writeln('4ucJlo n?');
readln(n);
if (n mod m = 0) or (m mod n=0) then write (1)
else writeln(random);
readln;
end.

program ypok;
uses crt;
var a,b:integer;
begin
clrscr;
writeln('DeHb?');
readln(a);
writeln('Ypok?');
readln(b);
writeln ((a-1)*6+b);
readln
end.

program Tpu_21_Bap;
uses crt;
const
n=10;
var
i,k,max:integer;
a:array[1..n] of integer;
b:array[1..n] of integer;
begin
clrscr;
writeln('MaccuB:');
for i:=1 to n do
begin
write('4ucJlo ');
readln(a[i]);
end;
writeln;
k:=0;
for i:=1 to n do
if (a[i] mod 3=0) AND (a[i] <>0) THEN
begin
inc(k);
b[k]:=a[i];
end;
if k=0 then write('Net elementov, kratnyh 3')
else
begin
writeln('Massiv elementov, kratnyh 3');
for i:=1 to k do write(b[i]:7);
end;
readln;
end.

program BTopoe_3adaHue;
uses crt;
var x:integer;
begin
clrscr;
write('x=');
readln(x);
if x<0 then write('sin(x)=-1') else
if x=0 then write('sin(x)=0') else
if x>0 then write('sin(x)=1');
readln;
end.