fork download
  1. Program pavement;
  2.  
  3. var
  4. H, S, T, W, Totvert, Totor, restovert, restoor, angolo : Longint;
  5. pezzivertcheservono, pezziorizzcheservono, Totintere, Totpezzi, rimanente : Longint;
  6. begin
  7. (* assign(input, 'input.txt'); reset(input);
  8.   assign(output, 'output.txt'); rewrite(output);*)
  9.  
  10. ReadLn(H, W, S);
  11. T := 0;
  12. Totvert:=H div S; Totor:=W div S;
  13. Totintere:=Totvert*Totor;
  14. restovert:=H mod S; restoor:=W mod S;
  15. if (H=1) then
  16. begin
  17. if W mod S =0 then
  18. begin
  19. if ((W div S ) mod 2 =0) then T:= (W div S) div 2
  20. else T:= (W div S) div 2 +1;
  21. end
  22. else T:= (W div S) div 2 +1;
  23.  
  24. end
  25. else
  26. begin
  27. if (restovert=0) or (restoor=0) then angolo:=0;
  28. if (restovert=0) and (restoor=0) then
  29. begin
  30. pezzivertcheservono:=0;
  31. pezziorizzcheservono:=0;
  32. angolo:=0;
  33. end
  34. else
  35. begin
  36.  
  37. if restovert<>0 then pezzivertcheservono:=Totor
  38. else begin pezzivertcheservono:=0;angolo:=0; end;
  39. if restoor<>0 then pezziorizzcheservono:=Totvert
  40. else begin pezziorizzcheservono:=0; angolo:=0; end;
  41. if (restovert+restoor<=S) then
  42. begin
  43. if (pezzivertcheservono+pezziorizzcheservono) mod 2 = 0 then Totpezzi:= (pezzivertcheservono+pezziorizzcheservono) div 2
  44. else Totpezzi:= (pezzivertcheservono+pezziorizzcheservono) div 2 +1;
  45. end
  46. else
  47. begin
  48. Totpezzi:= pezzivertcheservono+Pezziorizzcheservono;
  49.  
  50. end;
  51. writeln (totintere, pezzivertcheservono, pezziorizzcheservono) ;
  52. T:=Totintere+Totpezzi+angolo;
  53. end;
  54. end;
  55. WriteLn(T);
  56.  
  57. end.
  58.  
Success #stdin #stdout 0s 5324KB
stdin
8 7 3
stdout
422
6