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. {
  8.   uncomment the two following lines if you want to read/write from files
  9.   assign(input, 'input.txt'); reset(input);
  10.   assign(output, 'output.txt'); rewrite(output);
  11. }
  12.  
  13. ReadLn(H, W, S);
  14.  
  15. T := 0;
  16. Totvert:=H div S; Totor:=W div S;
  17. Totintere:=Totvert*Totor; writeln(Totintere);
  18. restovert:=H mod S; restoor:=W mod S;
  19. if (restovert=0) and (restoor=0) then
  20. begin
  21. pezzivertcheservono:=0;
  22. pezziorizzcheservono:=0;
  23. end
  24. else
  25. begin
  26.  
  27. pezzivertcheservono:=Totor;
  28. pezziorizzcheservono:=Totvert;
  29. if restovert+restoor<=S then
  30. begin
  31. if pezzivertcheservono>=Pezziorizzcheservono then
  32. begin
  33. Totpezzi:=pezzivertcheservono;
  34. rimanente:=Totpezzi-Pezziorizzcheservono;
  35. writeln(rimanente);
  36. end
  37. else
  38. begin
  39. Totpezzi:=pezziorizzcheservono;
  40. rimanente:=Totpezzi-Pezzivertcheservono;
  41. end;
  42. if (restovert=0) and (restoor=0) then angolo:=0
  43. else
  44. begin
  45. if (rimanente=0) then angolo:=1
  46. else angolo:=0;
  47. end;
  48. end
  49. else
  50. begin
  51. Totpezzi:= pezzivertcheservono+Pezziorizzcheservono;
  52. angolo:=1;
  53. end;
  54. end;
  55. writeln(Totpezzi, ' ', angolo);
  56. T:=Totintere+Totpezzi+angolo;
  57. WriteLn(T);
  58.  
  59. end.
  60.  
Success #stdin #stdout 0s 5324KB
stdin
8 8 4
stdout
4
0 0
4