zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    16. Vue 登录存储
    JS 10位、13位时间戳转日期
    14.Vue 定义全局函数
    13.Vue+Element UI实现复制内容
    12.Vue+Element UI 获取input的值
    11.Vue安装Axios及使用
    Layui入手
    MongoDB自启动设置
    sql数据统计
    sql查询总结
  • 原文地址:https://www.cnblogs.com/z-712/p/7307529.html
Copyright © 2011-2022 走看看