Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- x,y,z,n,i,pola,br:longint;
- s:string;
- begin
- readln( n );
- for i:=1 to n do
- begin
- readln( s );
- if s='1/2' then inc(x);
- if s='1/4' then inc(y);
- if s='3/4' then inc(z);
- end;
- pola:=x div 2;
- if (y > 2) and (x mod 2=1) then
- begin
- inc(pola);
- y:=y-2;
- end;
- if z>y then
- begin
- while y>0 do
- begin
- inc(br);
- dec(z);
- dec(y);
- end;
- br:=br+z;
- end;
- if z<y then
- begin
- while z>0 do
- begin
- inc(br);
- dec(z);
- dec(y);
- end;
- if y mod 4= 0 then br:=br+y div 4 else br:=br+y div 4 +1;
- end;
- writeln(pola+br);
- end.
Add Comment
Please, Sign In to add comment