Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. var
  2. x,y,z,n,i,pola,br:longint;
  3. s:string;
  4.  
  5.  
  6. begin
  7. readln( n );
  8.  
  9. for i:=1 to n do
  10. begin
  11. readln( s );
  12. if s='1/2' then inc(x);
  13. if s='1/4' then inc(y);
  14. if s='3/4' then inc(z);
  15. end;
  16.  
  17. pola:=x div 2;
  18. if (y > 2) and (x mod 2=1) then
  19. begin
  20. inc(pola);
  21. y:=y-2;
  22. end;
  23.  
  24. if z>y then
  25. begin
  26. while y>0 do
  27. begin
  28. inc(br);
  29. dec(z);
  30. dec(y);
  31. end;
  32. br:=br+z;
  33. end;
  34. if z<y then
  35. begin
  36. while z>0 do
  37. begin
  38. inc(br);
  39. dec(z);
  40. dec(y);
  41. end;
  42.  
  43. if y mod 4= 0 then br:=br+y div 4 else br:=br+y div 4 +1;
  44. end;
  45.  
  46. writeln(pola+br);
  47.  
  48. end.
Add Comment
Please, Sign In to add comment