Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program stepan_and_spichki;
- const
- n =100;
- var
- f1,f2:text;
- s,simv,p :string;
- nabor : array [1..n] of string;
- pornabor : array [1..20] of integer;
- i,j,t,g,mas,x,y,z,code,tmp, tmp2, tmp3, tmp4:integer;
- xb,yb,zb:boolean;
- begin
- readln(nabor[1]);
- val(nabor[1], tmp, code);
- for i:= 1 to tmp do
- begin
- Readln(nabor[i+1]);
- if copy(nabor[i+1],length(nabor[i+1]),1) <> ' ' then nabor[i+1]:=nabor[i+1]+' ';
- end;
- for t:= 1 to tmp do
- begin
- p := nabor[t+1];
- simv := '';
- j:=0;
- for i := 1 to length(p) do
- begin
- if pos(p[i], ' ') = 0 then
- simv := simv + p[i]
- else
- begin
- if length(simv)>0 then
- begin
- inc(j);
- val(simv, tmp2, code);
- pornabor[j] := tmp2;
- simv := '';
- end;
- end;
- end;
- g:=j;
- for i:= 1 to g-1 do
- for j:=i+1 to g do
- if pornabor[i]>pornabor[j] then
- begin
- mas:=pornabor[i];
- pornabor[i]:=pornabor[j];
- pornabor[j]:=mas;
- end;
- x:=0;
- y:=0;
- z:=0;
- for i:= 1 to g do
- begin
- if x<>pornabor[i] then
- begin
- x:=pornabor[i];
- if y>= 4 then
- begin
- inc(z);
- end;
- y:=0;
- inc(y);
- end
- else
- begin
- inc(y);
- end;
- end;
- if y>=4 then
- begin
- inc(z);
- y:=0;
- end;
- if z>=3 then writeln('yes') else writeln('no');
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment