SaveText.Ru

Без имени
  1. var
  2. m5,m2,mx1,mx2,mnd2,mnd5,i,x,n,r,r1:integer;
  3. begin
  4.   readln(n);
  5.   m5:=0; m2:=0; mx1:=0; mx2:=0; mnd2 := 0; mnd5:=0;
  6.   for i:=1 to n do
  7.   begin
  8.     readln(x);
  9.     if x mod 10 <> 0 then
  10.     begin
  11.       if (x mod 5 = 0) and (x > m5) then
  12.         m5:= x
  13.       else if (x > mnd2) and (x mod 2 <> 0) then
  14.         mnd2:=x;
  15.       if (x mod 2 = 0) and (x > m2) then
  16.         m2:= x
  17.       else if (x > mnd5) and (x mod 5 <> 0) then
  18.         mnd5:=x;
  19.       if (x mod 5 <> 0) and (x mod 2 <> 0) then
  20.       begin
  21.         if (x > mx1) then
  22.         begin
  23.           mx2:=mx1;
  24.           mx1:=x;
  25.         end
  26.         else if x > mx2 then
  27.           mx2:=x;
  28.       end;
  29.      
  30.     end;
  31.   end;
  32.   readln(r);
  33.   r:=0;
  34.   if (m5 * mnd2 > r1) and (m5 <> 0) and (mnd2 <> 0) then
  35.     r1 := m5 * mnd2;
  36.   if (m2 * mnd5 > r1) and (m2 <> 0) and (mnd5 <> 0) then
  37.       r1 := m2 * mnd5;
  38.   if (mx1 * mx2 > r1) and (mx1 <> 0) and (mx2 <> 0) then
  39.  writeln('Computed checksum: ', r1);
  40.  if r1 = r then writeln('Checksum control: pass')
  41.  else writeln('Checksum control: fail');
  42. end.

Share with your friends:

Print