hozer

Program stepan_and_spichki;

Apr 26th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.45 KB | None | 0 0
  1. Program stepan_and_spichki;
  2. const
  3.  n =100;
  4. var
  5. f1,f2:text;
  6. s,simv,p :string;
  7. nabor : array [1..n] of string;
  8. pornabor : array [1..20] of integer;
  9. i,j,t,g,mas,x,y,z,code,tmp, tmp2, tmp3, tmp4:integer;
  10.  xb,yb,zb:boolean;
  11. begin
  12. readln(nabor[1]);
  13.  
  14. val(nabor[1], tmp, code);
  15. for i:= 1 to tmp do
  16. begin
  17. Readln(nabor[i+1]);
  18. if copy(nabor[i+1],length(nabor[i+1]),1) <> ' ' then nabor[i+1]:=nabor[i+1]+' ';
  19. end;
  20.        
  21.        for t:= 1 to tmp do
  22.         begin
  23.         p := nabor[t+1];
  24.  simv := '';
  25.  j:=0;
  26.  for i := 1 to length(p) do
  27.  begin
  28.     if pos(p[i], ' ') = 0 then
  29.           simv := simv + p[i]
  30.     else
  31.      begin
  32.      if length(simv)>0 then
  33.      begin
  34.      inc(j);
  35.      val(simv, tmp2, code);
  36.      pornabor[j] := tmp2;
  37.              simv := '';
  38.              end;
  39.      end;
  40.  end;
  41.  
  42.         g:=j;
  43.     for i:= 1 to g-1 do
  44. for j:=i+1 to g do
  45. if pornabor[i]>pornabor[j] then
  46.  begin
  47.   mas:=pornabor[i];
  48.   pornabor[i]:=pornabor[j];
  49.   pornabor[j]:=mas;
  50.  end;
  51.  
  52.   x:=0;
  53.   y:=0;
  54.   z:=0;
  55.  for i:= 1 to g do
  56.   begin
  57.   if x<>pornabor[i] then
  58.   begin
  59.  
  60.   x:=pornabor[i];
  61.  
  62.                  if y>= 4 then
  63.                  begin
  64.                  inc(z);
  65.  
  66.                  end;
  67.     y:=0;
  68.     inc(y);
  69.   end
  70.   else
  71.   begin
  72.    inc(y);
  73.   end;
  74.  
  75.   end;
  76.   if y>=4 then
  77.                  begin
  78.                  inc(z);
  79.                  y:=0;
  80.                  end;
  81.  
  82.   if z>=3 then writeln('yes') else writeln('no');
  83.  
  84.  end;
  85.  end.
Advertisement
Add Comment
Please, Sign In to add comment