博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1A. Theatre Square
阅读量:6083 次
发布时间:2019-06-20

本文共 1213 字,大约阅读时间需要 4 分钟。

A. Theatre Square

time limit: per test 1 second

memory limit: per test 256 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.
Examples
input
6 6 4
output
4
需要注意越界,可能出现1018。因此尽量用long long。 编写此程序时出现失误,long与long long是不同的。

#include 
#include
using namespace std;int main(int argc, char *argv[]){ long n,m,a; cin>>n>>m>>a; long long width = ceil(((double)m)/a); long long height = ceil(((double)n)/a); cout<
<

转载于:https://www.cnblogs.com/GoFly/p/5751074.html

你可能感兴趣的文章
HDU 4803 Poor Warehouse Keeper (贪心+避开精度)
查看>>
JVM
查看>>
微服务学习笔记
查看>>
UDP示例
查看>>
数据结构12-AVL树
查看>>
iOS开发之BLE(一)——理论知识
查看>>
Sql 查询锁
查看>>
HTTP Protocol
查看>>
Codeforces 919E - Congruence Equation
查看>>
React Diff 算法
查看>>
返回上一页几种方法
查看>>
WPF 自定义ComboBox样式,自定义多选控件
查看>>
WPF 自定义MenuItem样式
查看>>
Numerical Geometry of Image
查看>>
1107 Social Clusters
查看>>
Python之路【第十八篇】:模块知识
查看>>
Frogger
查看>>
人机交互评价
查看>>
python发送邮件
查看>>
从页面上灵活增删改查
查看>>