• A. Theatre Square


    Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.

    What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

    Input

    The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).

    Output

    Write the needed number of flagstones.

    Examples
    input
    6 6 4
    output
    4
     1 #include <iostream>
     2 
     3 using namespace std;
     4 int main(){
     5     long long  n,m,a;
     6     cin>>n>>m>>a;
     7     long long  sum=0;
     8     int b1=0,b2=0;
     9     if(n%a) b1=1;
    10     if(m%a) b2=1;
    11     sum=(n/a+b1)*(m/a+b2);
    12     cout<<sum<<endl;
    13 return 0;
    14 }
  • 相关阅读:
    类BufferedImage
    Fileltem
    文件上传api——MultipartFile
    热插播 devtools
    生成banner
    maven 配置
    配置java环境变量
    u盘如何恢复存储量
    四则运算
    PM
  • 原文地址:https://www.cnblogs.com/z-712/p/7307529.html
Copyright © 2020-2023  润新知