Codeforces Beta Round #1
来源:互联网 发布:风电中国 知乎 编辑:程序博客网 时间:2024/06/05 16:15
http://codeforces.com/contest/1/problem/A
A. Theatre Square
time limit per test
2 secondsmemory limit per test
64 megabytesinput
standard inputoutput
standard outputTheatre 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 test(s)
input
6 6 4
output
4
题目大意:用最少的正方形砖,填矩形,输出最小数量
/* ***********************************************
Author :
Created Time :2015/5/30 21:31:27
File Name :3.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 1<<30
#define maxn 10000+10
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
bool cmp(int a,int b){
return a>b;
}
int main()
{
#ifndef ONLINE_JUDGE
//freopen("in.txt","r",stdin);
#endif
//freopen("out.txt","w",stdout);
ll n,m,a;
while(cin>>n>>m>>a){
ll b=m/a+(m%a==0?0:1);
ll c=n/a+(n%a==0?0:1);
cout<<b*c<<endl;
}
return 0;
}
0 0
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1
- Codeforces Beta Round #1 练习
- Codeforces Beta Round #1 ABC
- Codeforces Beta Round #1(A,B)
- Codeforces Beta Round #83 (Div. 1 Only)
- Codeforces Beta Round #1 A B C
- Codeforces Beta Round #1 A题
- Codeforces Beta Round #1 A B C
- Codeforces Beta Round #1 A - Theatre Square
- Codeforces Beta Round #1 A. Theatre Square
- sicily 1031. Campus (优先队列优化的dijistra模板)
- (转)图算法单源最短路径Dijkstra算法(邻接表/邻接矩阵+优先队列STL)
- Codeforces Round #303 (Div. 2)
- BestCoder Round #42(3/4)
- Vijos之暴力枚举
- Codeforces Beta Round #1
- Codeforces Beta Round #2
- Codeforces Beta Round #3
- 广义表的基本操作实现
- Codeforces Beta Round #4 (Div. 2 Only)
- Codeforces Beta Round #5
- Providing Resource
- leetcode——338——Counting Bits
- HDU 1878 欧拉回路