codeforces 1A Theatre Square
来源:互联网 发布:sql镜像服务器 编辑:程序博客网 时间:2024/05/06 19:43
Theatre Square in the capital city of Berland has a rectangular shape with the sizen × 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.
The input contains three positive integer numbers in the first line: n, m and a (1 ≤ n, m, a ≤ 109).
Write the needed number of flagstones.
Input
6 6 4
Output
4
这道题也是很简单,意思就是n*m的长方形用边长是m的小正方形去铺,最少要多少块,其实就是分成长和
宽,如果刚好匹配,就用出发,不然就多一快,最后把他们相乘#include<iostream>using namespace std;int main(){ long long n,m,a; while(cin>>n>>m>>a) { long long number,numbern,numberm; if(n%a==0) numbern = n/a; else numbern = n/a+1; if(m%a==0) numberm = m/a; else numberm = m/a+1; number = numberm*numbern; cout<<number<<endl; }}
就好
0 0
- 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(水)
- ZOJ-3537 Cake(区间dp+凸包最优三角形剖分)
- 理解javascript中的立即执行函数(function(){})()
- mysql5.7.17主从配置
- ps构建gif动图
- 数学基础-扩展欧几里得模板
- codeforces 1A Theatre Square
- 文章标题 Android系统广播的发送短信和接收短信的一些用法
- POj 3819 Coverage 已被翻译
- BZOJ 1878, HH的项链
- ubnutu环境变量设置和sublime环境设置
- VC++ CEdit 和 CComboBox类 的使用
- 1月18日(作业)
- c++火柴棒问题
- Storm教程2安装部署