CodeForces 1A Theatre Square
来源:互联网 发布:网络存储空间哪个好 编辑:程序博客网 时间:2024/04/29 13:39
题目:
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>using namespace std;int main(){long long m,n,a;while (cin >> m >> n >> a)cout << ((m - 1) / a + 1)*((n - 1) / a + 1) << endl;return 0;}要注意的地方就是,当a=1,m和n特别大的时候,结果用int来保存是不够的。
- CodeForces 1A Theatre Square
- Codeforces 1A. Theatre Square
- codeforces 1A-Theatre Square
- 【CodeForces】[1A]Theatre Square
- CodeForces 1A Theatre Square
- CodeForces 1A Theatre Square
- CodeForces 1A Theatre Square
- codeforces 1A Theatre Square
- CodeForces 1A Theatre Square
- Codeforces 1A Theatre Square
- Codeforces 1A. Theatre Square
- codeforces 1A Theatre Square
- codeforces 1A Theatre Square
- CODEFORCES:A. Theatre Square
- Codeforces Beta Round #1 A - Theatre Square
- Codeforces Beta Round #1 A. Theatre Square
- Codeforces Round #1A Theatre Square
- Codeforces 1A-Theatre Square(水)
- centOS 7安装后无法上网+虚拟机不能安装问题解决
- windows 文件夹挂载到linux目录下
- MySQL中if case条件语句基本用法
- ueditor1_4_3-utf8-jsp 配置实现上传图片的功能
- IOS 安装 ffmpeg
- CodeForces 1A Theatre Square
- Linux + python +mysqlDB + mysql + innoDB
- 手把手教你做安卓应用开发-目录
- normalize.css
- Android launcher 开发笔记(三) 启动过程分析 part 1
- 类型信息
- Linux中zip压缩和unzip解压缩命令详解
- Java 8 数据流教程
- Activity是否显示