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. RSA大会播报 – 2014最佳安全博客提名

    今年美国RSA大会将在这个月的23-28号举行,每年大会上都会评出过去一年来业内最佳安全博客(Security Bloggers Network Social Security Awards 2014 ...

  2. metal2的四个新features

    https://developer.apple.com/documentation/metal/mtldevice/ios_and_tvos_devices/about_gpu_family_4 Im ...

  3. csm pssm +pcf pcss sdsm

    这几个shadow算法 pcf是sample时候用的 按照一个mode采样几个位置 根据采样结果 决定0-1  可以是0.234 这样就不是 0或者1 就是soft了 主要讲下pcss 是啥 因为我之 ...

  4. JavaScript中的单引号和双引号解决

    在使用JavaScript显示消息或者传递字符数据的时候,经常会碰到数据中夹杂单引号(')或者双引号("),这种语句往往会造成JavaScript报错.对此一般采用/'或者/"的解 ...

  5. leetCode 86.Partition List(分区链表) 解题思路和方法

    Given a linked list and a value x, partition it such that all nodes less than x come before nodes gr ...

  6. 【Cocos2d-x 3.0】游戏开发之android交叉编译

    作者:Senlern 转载请注明,原文链接:http://blog.csdn.net/zhang429350061/article/details/37959489 在上一篇文章我分享了如在win32 ...

  7. PHP - AJAX 与 PHP

    PHP - AJAX 与 PHP AJAX 被用于创建交互性更强的应用程序. AJAX PHP 实例 下面的实例将演示当用户在输入框中键入字符时,网页如何与 Web 服务器进行通信: 实例 尝试在输入 ...

  8. 对hadoop 执行mapreduce时发生异常Illegal partition for的解决过程

    来自:http://blog.csdn.net/hezuoxiang/article/details/6878026 写了个mapreduce的JAVA程序,自定义了个partition class ...

  9. jquery翻页

    http://js.itivy.com/simplePagination.js/index.html#page-10 http://www.oschina.net/news/41941/7-html5 ...

  10. Linux 监测网络常用的工具sar iftop netstat ping nping fping mtr

    Linux 监测网络常用的工具sar iftop netstat ping nping fping mtr # sar -n DEV 1 2 # iftop # netstat -i # ping n ...