http://codeforces.com/problemset/problem/1/A

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


看懂题意,注意一点就行了,就是不能有没有覆盖的地方,求用的最少砖的数量


AC代码:
#include<iostream>
#include<cstdio> using namespace std; int main()
{
__int64 m,n,a,sum,x,y;
while(scanf("%I64d%I64d%I64d",&n,&m,&a)!=EOF)
{
if(n%a == 0)
{
x = n/a;
}
else
{
x = n/a+1;
}
if(m%a == 0)
{
y = m/a;
}
else
{
y = m/a+1;
}
// printf("%I64d %I64d\n",x,y);
sum = x*y;
printf("%I64d\n",sum);
} return 0;
}

Theatre Square的更多相关文章

  1. cf--------(div1)1A. Theatre Square

    A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard in ...

  2. CF Theatre Square

    Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input ...

  3. codeforce 1A Theatre Square

    A. Theatre Square Theatre Square in the capital city of Berland has a rectangular shape with the siz ...

  4. CodeForces 1A Theatre Square

    A - Theatre Square Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u ...

  5. A. Theatre Square(math)

    A. Theatre Square time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  6. Educational Codeforces Round 88 (Rated for Div. 2) B、New Theatre Square C、Mixing Water

    题目链接:B.New Theatre Square 题意: 你要把所有"." 都变成"*",你可以有两个选择,第一种就是一次铺一个方块(1*1),第二种就是同一 ...

  7. 1A Theatre Square

    题目大意; 有一个广场,广场的大小是n*m,  有a*a的石砖,石砖铺广场可以比广场大,石砖不能切割.问最少需要多少个石砖. ===================================== ...

  8. codeforces水题100道 第一题 Codeforces Beta Round #1 A. Theatre Square (math)

    题目链接:http://www.codeforces.com/problemset/problem/1/A题意:至少用多少块边长为a的方块铺满NxM的矩形区域.C++代码: #include < ...

  9. Codeforces Beta Round #1 A. Theatre Square

    从今天開始.就要在Codeforces里有一个新的開始了,貌似任务非常重的说~~ Codeforces专题我将会记录全部通过的题目,事实上仅仅要通过的题目都是水题啊!. 题目大意: 依照要求计算须要多 ...

随机推荐

  1. spring初探1

    spring初探1 关于新建对象,对象依赖的三种方式比较 场景 某个交易的业务组建拆分,为原先的功能模块新写了一个业务组件 使用new. 修改上层代码的对象生成部分( 如果不是面向接口编程,简直就是灾 ...

  2. activity切换时的overridePendingTransition动画效

      注意,切换方法overridePendingTransition只能在startActivity和finish方法之后调用.第一个参数为第一个Activity离开时的动画,第二参数为所进入的Act ...

  3. BITED-Windows8应用开发学习札记之一:Win8应用开发入门

    基于WinRT的Metro应用是我对Windows8的第一印象,简洁方块配以简单色调真的有沁人心脾的美感. 非常幸运,BITED在这个暑假的这个小学期里有幸学习到一门课程:软件工程基础实践,老师邀请了 ...

  4. 10个优质PSD文件资源下载

    很多设计需求并不一定要从头开始设计,你完全可以通过已有的灵感或素材开始设计任务.这个时候你可能需要一些PSD资源作为参考.今天我整理了一些常用的PSD资源供需要的朋友免费下载使用. Web & ...

  5. Windows平台分布式架构-负载均衡(高并发)

    缘由 单纯想在winodows平台部署分布式程序,微软在IIS扩展的介绍中有涉及到Application Request Router + Web Farm + Url Rewriter可以实现分布式 ...

  6. SSO单点登录在web上的关键点 cookie跨域

    概述 其实WEB单点登录的原理挺简单的,抛开那些复杂的概念,简单来讲讲如何实现一个最基本的单点登录 首先需要有两个程序 例如:http://www.site-a.com 我们简称A http://ww ...

  7. 基于MapReduce的关系代数运算(2)

    1.自然连接 Map函数:对于R中的每个元组(a,b),生成键值对(b,(R,a)),对于S中的每个元组(b,c),生成键值对(b,(S,c)) Reduce函数:每个键值b会与一系列对相关联,这些对 ...

  8. NServiceBus教程-消息传递与处理

    nservicebus"的容错默认"设计的一部分,基础设施管理事务自动所以你不需要记住所有的线程和状态管理要素配置. 客户端和服务器 理想情况下,服务器代码处理消息事务,但它往往不 ...

  9. 谈FTP服务器攻击技术及其展望 (修改中)

      欢迎大家给我投票: http://2010blog.51cto.com/350944 请看下篇:谈FTP服务器攻击技术及其展望 (下)              全文完http://chengua ...

  10. jquery获取显示器,屏幕的宽度,和高度

    Javascript: 网页可见区域宽: document.body.clientWidth网页可见区域高: document.body.clientHeight网页可见区域宽: document.b ...