CodeForces 1A 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
6 6 4
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的更多相关文章
- cf--------(div1)1A. Theatre Square
A. Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard in ...
- codeforce 1A Theatre Square
A. Theatre Square Theatre Square in the capital city of Berland has a rectangular shape with the siz ...
- 1A Theatre Square
题目大意; 有一个广场,广场的大小是n*m, 有a*a的石砖,石砖铺广场可以比广场大,石砖不能切割.问最少需要多少个石砖. ===================================== ...
- Educational Codeforces Round 88 (Rated for Div. 2) B、New Theatre Square C、Mixing Water
题目链接:B.New Theatre Square 题意: 你要把所有"." 都变成"*",你可以有两个选择,第一种就是一次铺一个方块(1*1),第二种就是同一 ...
- Theatre Square
http://codeforces.com/problemset/problem/1/A Theatre Square time limit per test 2 seconds memory lim ...
- CF Theatre Square
Theatre Square time limit per test 2 seconds memory limit per test 64 megabytes input standard input ...
- Codeforces 828B Black Square(简单题)
Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. ...
- A. Theatre Square(math)
A. Theatre Square time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- codeforces水题100道 第一题 Codeforces Beta Round #1 A. Theatre Square (math)
题目链接:http://www.codeforces.com/problemset/problem/1/A题意:至少用多少块边长为a的方块铺满NxM的矩形区域.C++代码: #include < ...
随机推荐
- MFC【5】MFC集合类
MFC集合类现在来看已经很落后了. 5.1数组 5.1.1MFC数组类 CArray类,它实际是一个模板类,利用它可以创建人和数据类型的类型安全数组.在头文件Afxtempl.h中定义了CArray. ...
- 使用BeyondCompare比较文件夹下的文件时,相同的文件内容,但显示为不相同
主要原因是: 两个文件行尾标题不一致而导致的,一个是PC,一个是Unix 解决办法: 随便比较文件夹中的两个文件,点击规则,去掉比较行尾(pc/mac/unix)选项,点击确认,回到文件夹比较界面,刷 ...
- 在低带宽或不可靠的网络环境中安装 Visual Studio 2017
在低带宽或不可靠的网络环境中安装 Visual Studio 2017 2017-4-141 分钟阅读时长 作者 https://docs.microsoft.com/zh-cn/visualstu ...
- 同步网络时间到linux服务器(先修改时区再进行同步网络时间)
查看时区:date -R 修改整个系统时区: rm -f /etc/localtime ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 网 ...
- es5 - array - shift
/** * 描述:该shift()方法从数组中删除第一个元素并返回已删除的元素.此方法更改数组的长度. * 语法:arr.shift() * 返回:该shift方法删除零点索引处的元素并将连续索引处的 ...
- MS SQL得到指定日期的当月月末
MS SQL得到指定日期的当月月末 declare @ddate date ,,)) select @ddate --2016-01-31 declare @ddatetime datetime ,, ...
- 在Jquery validation里验证通过后,自定义提交不同的action路径,适合一个窗口既可以作为添加对话框也可以作为编辑对话框
$("#myform").validate({ debug: true, //调试模式取消submit的默认提交功能 ignore: '#Password,#ConfirmPass ...
- MSS & MTU
- 35 、HashSet详解
HashSet特点 1.不能保证元素的排列顺序 2.没有重复元素 3.HashSet不是同步的,多个线程同时访问一个HashSet,需要通过代码来保持同步 4.集合元素可以是null 当向HashSe ...
- ubuntu开启ftp服务
首先再防火墙中开启21和20端口 iptables -A INPUT -p tcp --dport -j ACCEPT iptables -A INPUT -p tcp --dport -j ACCE ...