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. Visual Studio 2013打开项目出现“未安装项目的目标框架”提示

    问题描述: windows 10 系统里用Visual Studio 2013打开项目,提示如下: 说项目的.NET Framework version=v4.5,系统里没装,让将项目的框架从v4.5 ...

  2. R语言颜色综合运用与色彩方案共享

    R语言颜色综合运用与色彩方案共享 小魔方 EasyCharts 2016-11-21 今天这篇主要讲解R语言颜色综合运用,主要跟大家介绍如何提取那些专业色彩包中的颜色搭配用于在基础绘图系统和高级绘图系 ...

  3. Hadoop生态圈-Sqoop部署以及基本使用方法

    Hadoop生态圈-Sqoop部署以及基本使用方法 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. Sqoop(发音:skup)是一款开源的工具,主要用于在Hadoop(Hive)与 ...

  4. SQL优化:

    今日给人查找数据,时间关系,写个比较粗暴的SQL语句:   #2s587ms#直接将所有表关联,比较粗暴 select go.businessId,dd.dict_namefrom fn_xte.gt ...

  5. 20155235 2016-2017-2 《Java程序设计》第六周学习总结

    20155235 2016-2017-2 <Java程序设计>第六周学习总结 教材学习内容总结 第十章 InputStream与OutputStreaam 串流设计的概念 串流继承架构 川 ...

  6. laravel二维数组手动分页显示

    示例:数组 $user 如下 $user: array (size=) 'sort' => array (size=) => float 0.028616622341171 => f ...

  7. 七牛云 上传图片 https 修改Nginx 注意事项

    仅在这记录下,今天的事情. 问题出自于Nginx 设置http 强制跳转 https设置 1.上午,出于某些需求,我将服务器Nginx 设置http 强行跳转 https server { liste ...

  8. Python概念-Item系列(林海峰教的)

    这个Item系列是egon老师自创的,个人还是可以接受这种文化底蕴的,所以直接拿来用,也是毫无违和感的 所谓Attr系列,其实是__setattr__,__delattr__,__getattr__ ...

  9. 初时Python博大精深

    Python是解释型语言 编译型vs解释型 编译型优点:编译器一般会有预编译的过程对代码进行优化.因为编译只做一次,运行时不需要编译,所以编译型语言的程序执行效率高.可以脱离语言环境独立运行.缺点:编 ...

  10. Java编程思想 4th 第3章 操作符

    有了数据,还需要进行数据间的运算,因此Java中也有数据间运算的各种符号,书本称之为操作符,正确的翻译应该是运算符. Java中的运算符同C++相同,运算符同运算符对象构成表达式,表达式是运算对象及运 ...