Вітаю Вас, Гість

Задача А

program p1_1;
var a,b,c,d,e,f:longint;
begin
  readln (a,b,c,d,e,f);
  writeln ((a*b*c+d*e*f)/1000:0:3)
end.

 

Задача B

program p1_2;
var c1,c2:char;
    k:integer;

procedure TestPair;
begin
  if c1=' '
  then  if c2 in ['a'..'z']
        then dec(k)
        else if c2 in ['A'..'Z']
             then inc(k);
end;

begin
  k:=0;
  c1:=' ';
  read(c2);

  repeat
    TestPair;
    c1:=c2;
    read(c2)
  until eoln(input);

  TestPair;

  writeln (k)
end.

 

Задача C

program p1_3;
var D,N,s1,s2,n1,n2,i:integer;
    m:array of integer;

procedure Sort;
var i,j,a:integer;

begin
  for i:=1 to N-1 do
  for j:=i-1 downto 0 do
    if m[j]>m[j+1]
    then begin a:=m[j]; m[j]:=m[j+1]; m[j+1]:=a end
    else break
end;

procedure Process;
begin
  s1:=0; s2:=0;
  n1:=0; n2:=N-1;

  while (s1<D) and (n1<=N-1) do
  if (s1+m[n1]<=D)
  then begin s1:=s1+m[n1]; inc (n1) end
  else break;

  while (s2<D) and (n2>=0) do
  if (s2+m[n2]<=D)
  then begin s2:=s2+m[n2]; dec (n2) end
  else break;
end;

begin
  readln (D,N);
  SetLength(m,N);

  for i:=0 to N-1 do
    readln (m[i]);

  Sort;

  Process;

  if s1<s2
  then writeln (s2,' ',N-n2-1)
  else writeln (s1,' ',n1)
end.


Задача D

program p1_4;
var k,s,a,b,c:longint;

begin
  readln (a,b,c);

  write ((a div c)*(b div c),' ');

  s:=(a mod c)*b+(b mod c)*(a-a mod c);
  k:=s div (c*c);

  if k*c*c<s then k:=k+1;
  writeln (k)
end.

 

Задача E

program p1_5;
var A,B,K1,K2,S:longint;

function min(a,b:longint):longint;
begin
  if a<b then min:=a else min:=b
end;

function max(a,b:longint):longint;
begin
  if a<b then max:=a else max:=b
end;

begin
  readln (A,B,K1,K2,S);

  if (min(A,B)<min(K1,K2)) and (max(A,B)<max(K1,K2))
  then begin
          write ('YES ');
          if (S>min(K1,K2))
          then writeln ('YES')
          else writeln ('NO')
       end
  else writeln ('NO NO')
end.