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

题目是用正方形(a*a)的瓷砖铺广场(m*n的矩形)  一定要铺满,可以有多出来的不过尽可能少。。

实质是,求上整数问题:  up(a/b) = ((a  + b -1) / b)

代码很短(python的特点):

n,m,a = [int(s) for s in raw_input().split()]
print ((n+a-1)/a)*((m+a-1)/a)

题解-python-CodeForces 1A的更多相关文章

  1. CodeForces 1A Theatre Square

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

  2. 【题解】Codeforces 961G Partitions

    [题解]Codeforces 961G Partitions cf961G 好题啊哭了,但是如果没有不小心看了一下pdf后面一页的提示根本想不到 题意 已知\(U=\{w_i\}\),求: \[ \s ...

  3. Codeforces Round #353 (Div. 2) ABCDE 题解 python

    Problems     # Name     A Infinite Sequence standard input/output 1 s, 256 MB    x3509 B Restoring P ...

  4. 【题解】Codeforces Round #798 (Div. 2)

    本篇为 Codeforces Round #798 (Div. 2) 也就是 CF1689 的题解,因本人水平比较菜,所以只有前四题 A.Lex String 题目描述 原题面 给定两个字符串 \(a ...

  5. 【题解】 Codeforces 662A Gambling Nim (线性基)

    662A,戳我戳我 Solution: 我们先取\(ans=a[1] \bigoplus a[2] \bigoplus ... \bigoplus a[n]\),然后我们定义\(c[i]=a[i] \ ...

  6. 【题解】 Codeforces 919F A Game With Numbers(拓扑排序+博弈论+哈希)

    懒得复制,戳我戳我 Solution: 我感觉我也说不太好,看Awson的题解吧. 说一点之前打错的地方: 连边存的是hash后的数组下标 if(ans[ num( C[a.hash()] , C[b ...

  7. 题解【CodeForces 910A The Way to Home】

    题目大意 一只青蛙现在在一个数轴上,它现在要从点 \(1\) 跳到点 \(n\) ,它每次可以向右跳不超过 \(d\) 个单位.比如,它可以从点 \(x\) 跳到点 \(x+a\)(\(1\le a\ ...

  8. 【题解】 Codeforces Edu44 F.Isomorphic Strings (字符串Hash)

    题面戳我 Solution 我们按照每个字母出现的位置进行\(hash\),比如我们记录\(a\)的位置:我们就可以把位置表示为\(0101000111\)这种形式,然后进行字符串\(hash\) 每 ...

  9. 【题解】 Codeforces Edu41 F. k-substrings (字符串Hash)

    题面戳我 Solution 我们正着每次都要枚举从长到短,时间复杂度承受不了,但是我们可以发现一个规律,假设某次的答案为\(x\),那么这个字符串为\(A+X+B\)组成,无论中间的\(X\)是重叠还 ...

  10. codeforces 1A - math - ceil

    2017-08-24 15:42:30 writer: pprp 感觉自己好菜啊,这个题都没有做的很好 题意很简单,用a * a 的地砖,将 n * m 的地板铺满,问最少需要多少个地砖? 一开始打算 ...

随机推荐

  1. 五、Linux学习之文件搜索命令

    一.文件搜索命令locate locate 文件名 在后台数据库中按文件名搜索,搜索速度最快 /var/lib/mlocate #locate命令所搜索的后台数据库(数据库不会实时刷新,所以新建的文件 ...

  2. ElasticStack系列之十三 & 联想补全策略

    业务需求 1. 实现搜索引擎前缀搜索功能(中文,拼音前缀查询及简拼前缀查询功能) 2. 实现摘要全文检索功能,及标题加权处理功能(按照标题权值高内容权值相对低的权值分配规则,按照索引的相关性进行排序, ...

  3. JVM小结--类文件结构

    字节码是构成Java平台无关性的基石.实现语言无关性的基础是虚拟机和字节码存储格式. Java语言中的各种变量.关键字和运算符的语义最终是由多条字节码命令组成,因此字节码命令所能提供的语义描述能力肯定 ...

  4. Linux系统自动备份的Shell

    公司现在需要对现有的服务器进行定期备份,并将备份文件放置到正在使用的NAS中去: 为了备份的效率,还需要对备份的文件进行筛选,排除一些后缀名的文件: 实现方法如下: 1. 编写备份的shell文件 在 ...

  5. kdissert:linux下的自由脑图软件

    ----------------------------------------------------作者: 吉庆   email: jiqingwu@gmail.commainpage: http ...

  6. 英雄无敌3开源引擎vcmi的编译安装

    TAGS: Heroes3, vcmi, opensourceDATE: 2013-08-23 vcmi是什么? vcmi 是经典的 SLG 英雄无敌3 的开源游戏引擎.原来的英雄无敌3只能在Wind ...

  7. 微信小程序开发教程(七)逻辑层——.js详解

    逻辑层,是事务逻辑处理的地方.对于小程序而言,逻辑层就是.js脚本文件的集合.逻辑层将数据进行处理后发送给视图层,同时接收视图层的事件反馈. 微信小程序开发框架的逻辑层是由JavaScript编写.在 ...

  8. iOS设备分辨率

    CHENYILONG Blog iOS设备分辨率 © chenyilong. Powered by Postach.io Blog

  9. HDU 2594 KMP

    题目链接 题意:给定两个字符串s1,s2,求最长的s1前缀s使得s为s2的最长后缀,输出该字符串和其长度. 题解:调换s1和s2的顺序,用KMP求解即可. #include <bits/stdc ...

  10. C# IsAssignableFrom与IsSubClassOf 判断匿名类是否继承父类

    public class Dog : Animal { public string name { get; set; } } public class Animal { public string i ...