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) and (restoor=0) then
  28. begin
  29. pezzivertcheservono:=0;
  30. pezziorizzcheservono:=0;
  31. end
  32. else
  33. begin
  34. pezzivertcheservono:=Totor;
  35. pezziorizzcheservono:=Totvert;
  36. if restovert+restoor<=S then
  37. begin
  38. if pezzivertcheservono>=Pezziorizzcheservono then
  39. begin
  40. Totpezzi:=pezzivertcheservono;
  41. rimanente:=Totpezzi-Pezziorizzcheservono;
  42. end
  43. else
  44. begin
  45. Totpezzi:=pezziorizzcheservono;
  46. rimanente:=Totpezzi-Pezzivertcheservono;
  47. end;
  48. if (restovert=0) and (restoor=0) then angolo:=0
  49. else
  50. begin
  51. if (rimanente=0) then angolo:=1
  52. else angolo:=0;
  53. end;
  54. end
  55. else
  56. begin
  57. Totpezzi:= pezzivertcheservono+Pezziorizzcheservono;
  58. angolo:=1;
  59. end;
  60. end;
  61. T:=Totintere+Totpezzi+angolo;
  62. end;
  63. WriteLn(T);
  64.  
  65. end.
Success #stdin #stdout 0.01s 5288KB
stdin
7 7 3
stdout
7