A - Theatre Square

Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Description

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 Input

Input
6 6 4
Output
4

主要是注意数据范围和进一法取近似值。
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
long int n,m,a;
while(~scanf("%ld%ld%ld",&n,&m,&a))
{
long long int r;
r=(n%a==)?n/a:n/a+;
long long int c;
c=(m%a==)?m/a:m/a+;
printf("%I64d\n",r*c);
}
return ;
}

CodeForces 1A 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. codeforce 1A Theatre Square

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

  3. 1A Theatre Square

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

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

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

  5. Theatre Square

    http://codeforces.com/problemset/problem/1/A Theatre Square time limit per test 2 seconds memory lim ...

  6. CF Theatre Square

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

  7. Codeforces 828B Black Square(简单题)

    Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. ...

  8. A. Theatre Square(math)

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

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

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

随机推荐

  1. oracle分析函数之windowing_clause--rows

    Some analytic functions allow the windowing_clause. In the listing of analytic functions at the end ...

  2. SVG 可伸缩矢量图形 简介 Path路径

    w3school:http://www.w3school.com.cn/svg/svg_intro.asp  SVG 意为可缩放矢量图形(Scalable Vector Graphics). SVG ...

  3. 自定义控件 淘宝头条【ViewFlipper】

    简易版 代码 ); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Acti ...

  4. jQuery序列化表单数据 serialize()、serializeArray()及使用

    1.serialize() 方法: serialize() 方法通过序列化表单值,创建 URL 编码文本字符串. 您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素 ...

  5. 是否 whether ,if

    f,whether这两个词都能引出宾语从句,词义是“是否”. if 为口语体.有时两个词可以通用,但是当所引出的从句为介词宾语或不定式短语时,则只能用whether My wife wants to ...

  6. k-means聚类算法C++实现

    原文:http://www.cnblogs.com/luxiaoxun/archive/2013/05/09/3069594.html Clustering 中文翻译作“聚类”,简单地说就是把相似的东 ...

  7. 【Project Euler 8】Largest product in a series

    题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × ...

  8. Linux 内存泄露小结

    本文仅限记录自己的一次 内存泄露追踪小记. 可能并不十分适用与大家的情况.而且方法也并不是很smart.仅做记录,能提供个思路更好.        一. 要问调试程序遇到什么问题最头疼, 内存泄露肯定 ...

  9. mac上xcode4和xcode5共存及修改默认打开方式

    先安装xcode4 安装之后,在所有程序里面---改名xcode 为 xcode4 安装xcode5  安装之后,在所有程序里面---改名为xcode 为xcode5 安装4,5之后,默认打开方式就是 ...

  10. iterator [ɪtə'reɪtə] 遍历器

    lterator 遍历器 遍历器是一种接口,它为不同的数据结构提供了统一的访问机制. 如果一个数据结构具有遍历器接口,那么就可以依次处理该数据结构的成员. 当前 javascript 用来表示集合的数 ...