Codeforces Beta Round #1 A. Theatre Square

1,题目描述:

A, 戏剧院广场
波兰的首都上的戏剧院广场是一个n*m平方米的矩形。在城市的周年庆时,决定用花岗岩石板铺设戏剧院。每个花岗岩大小为a*a。
请问最少需要多少石板?允许覆盖部分超过广场的地板,但是必须广场必须全部被铺满。不允许打破石板。石板的边必须和广场的边平行。
输入:
三个正整数在第一行:n,m和a。(1<=n,m,a<=1e9)
输出:
显示需要的石板的数量。

2,题目链接:

http://codeforces.com/contest/1/problem/A

3,通过的代码:

#include<iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    long long  n,m,a;cin>>n>>m>>a;
    n=n%a==0?n/a:n/a+1;
    m=m%a==0?m/a:m/a+1;
    cout<<n*m<<endl;
}

猜你喜欢

转载自blog.csdn.net/light2chasers/article/details/80754777