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. angolo:=0;
  32. end
  33. else
  34. begin
  35. angolo:=1;
  36. if restovert<>0 then pezzivertcheservono:=Totor
  37. else begin pezzivertcheservono:=0;angolo:=0; end;
  38. if restoor<>0 then pezziorizzcheservono:=Totvert
  39. else begin pezziorizzcheservono:=0; angolo:=0; end;
  40. if restovert+restoor<=S then
  41. begin
  42. if (pezzivertcheservono+pezziorizzcheservono) mod 2 = 0 then Totpezzi:= (pezzivertcheservono+pezziorizzcheservono) div 2
  43. else Totpezzi:= (pezzivertcheservono+pezziorizzcheservono) div 2 +1;
  44. end
  45. else
  46. begin
  47. Totpezzi:= pezzivertcheservono+Pezziorizzcheservono;
  48. angolo:=1;
  49. end;
  50. writeln (totintere, pezzivertcheservono, pezziorizzcheservono) ;
  51. T:=Totintere+Totpezzi+angolo;
  52. end;
  53. end;
  54. WriteLn(T);
  55.  
  56. end.
  57. (* if pezzivertcheservono>=Pezziorizzcheservono then
  58.   begin
  59.  
  60.  
  61.   Totpezzi:=pezzivertcheservono;
  62.   rimanente:=Totpezzi-Pezziorizzcheservono;
  63.   end
  64.   else
  65.   begin
  66.   Totpezzi:=pezziorizzcheservono;
  67.   rimanente:=Totpezzi-Pezzivertcheservono;
  68.   end;
  69.   if (restovert=0) and (restoor=0) then angolo:=0
  70.   else
  71.   begin
  72.   if (rimanente=0) then angolo:=1
  73.   else angolo:=0;
  74.   end;
  75.   end
  76.   else
  77.   begin
  78.   Totpezzi:= pezzivertcheservono+Pezziorizzcheservono;
  79.   angolo:=1;
  80.   end;
  81.   end;
  82.  
  83.   end;*)
  84.  
Success #stdin #stdout 0s 5320KB
stdin
5 7 3
stdout
221
5