Theatre Square

time limit per test

2 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Sample test(s)
Input
6 6 4
Output
4

易知,n/a即为需要多少块a,每一块a都能完全用完,又知,n%a若不零,那么还需要再添加一块,若为零则不需要。
所以总的块数即为(n / a + (n % a) ? 1 : )) * (m / a + (m % a) ? 1 : 0)
 #include <iostream>
#include <cstdio>
using namespace std; int main(void)
{
long long n,m,a;
long long ans; scanf("%lld%lld%lld",&n,&m,&a);
ans = (n / a + ((n % a) ? : )) * (m / a + ((m % a) ? : ));
printf("%lld\n",ans); return ;
}

最新文章

  1. WPF DevExpress 设置雷达图Radar样式
  2. RabbitMQ修改端口号和心跳时间
  3. E - Super Jumping! Jumping! Jumping!
  4. 国内外从事CV相关的企业
  5. WIN8 MTK驱动不能安装解决办法
  6. Ubuntu上安装Apache、MySql和PHP
  7. jsp--文本框正则表达式
  8. Android开发之Handler
  9. fatal error LINK1123:failure during conversion to COFF:file invalid or corrupt
  10. Hbase对hive的支持没有hdfs的好的原因 及hbase什么时候使用 及rowkey设计技巧
  11. 【转】CentOS 使用yum命令安装出现错误提示&rdquo;could not retrieve mirrorlist http://mirrorlist.centos.org ***&rdquo;
  12. Cshap 使用http发起请求.
  13. 九宫格问题 A*
  14. 【Spark2.0源码学习】-1.概述
  15. python_如何在循环引用中管理内存?
  16. kubernetes进阶(05)kubernetes的命令
  17. 面向对象版Tab栏切换
  18. struts2默认临时文件更改
  19. 使用html中的&lt;input&gt;标签上传多个文件(转)
  20. 2018.09.07 Amount of degrees(数位dp)

热门文章

  1. Adress
  2. firefox 对相对定位的TD元素渲染错误
  3. Struts2运行流程分析
  4. Linux 命令之last命令详解
  5. Spring入门(7)-自动检测Bean
  6. Java线程池学习
  7. IE 、Firefox、Chrome 浏览器在 F12 控制台下切换至不同框架介绍
  8. struts validate
  9. linux下的shell命令的编写,以及java怎样调用linux的shell命令(java怎样获取linux上的网卡的ip信息)
  10. 【WinForm】C# 采用POST登录京东