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 < ...
随机推荐
- sql表值参数
using System;using System.Collections;using System.Collections.Specialized;using System.Data;using S ...
- 转: SVN和Git的一些用法总结
转:http://www.codelast.com/?p=5719 转载请注明出处:http://www.codelast.com/ 以下都是比较基础的操作,高手们请绕道,不必浪费时间来看了. (A) ...
- asp与aspx有什么区别
asp与aspx哪个好? 最佳答案 你如果想知道哪个好,我想很多人第一个想法就是aspx好. 这很好理解,就像楼上的朋友说的,aspx是asp的升级版. 但是aspx相对于asp的升级可以说是从根本上 ...
- Xcode 打包 ipa 包
原地址:http://zengwu3915.blog.163.com/blog/static/27834897201362831449893/ 上次介绍了木有证书的打包ipa.如果安装证书后,我们还有 ...
- QtGui.QLineEdit
A QtGui.QLineEdit is a widget that allows to enter and edit a single line of plain text. There are u ...
- OFBiz:添加样式【转】
原文地址:http://www.cnblogs.com/ofbiz/p/3205851.html 1. 打开themes文件夹,拷贝一份样式作为自己的样式更改初始样式,我这里拷贝的是flatgrey文 ...
- hibernate+spring mvc, 解决hibernate 对象懒加载 json序列化问题
引用地址 在使用Spring MVC时,@ResponseBody 注解的方法返回一个有懒加载对象的时候出现了异常,以登录为例: @RequestMapping("login") ...
- 【TP3.2.3】微信网页授权--基类
非常好用的微信授权 基类:其他的微信权限类都可以继承至该类: <?php namespace Wechat\Controller; use Think\Controller; //微信接口基础类 ...
- Mysql Communications link failure 问题的解决
问题现象 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last p ...
- git的常见操作方法
GIT操作方法 http://git.oschina.net/ g进入https://git-for-windows.github.io/下载安装 g启动命令窗口输入以下内容 git config - ...