1A-Theatre Square

Problem - 1A - Codeforces
A. Theatre Square

Theatre Square in the capital city of Berland has a rectangular shape with the sizen×mmeters. 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 sizea×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,manda(1 ≤n,m,a≤ 109).

Output

Write the needed number of flagstones

十分简单,直接上代码。
C++实现:

#include<bits/stdc++.h>
using namespace std;
int main()
{
        long long int n,m,a,nx,mx;
    cin>>n>>m>>a; 
    nx=n/a+(n%a?1:0);
    mx=m/a+(m%a?1:0);
    cout<<nx*mx<<endl;
    return 0;
 } 
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,451评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,940评论 0 23
  • 楔子: 亥时,墨月殿里灯火通明,紫檀木雕花的大床上女子死死的咬住自己的双唇,企图不让自己痛吟出声,汗水打湿了碎发,...
    君冷月阅读 14,064评论 2 5
  • 入冢 湿滑逼仄的甬道内,我、老葛、大头还有秦半仙四个人在缓慢的爬行,过了好久,甬道的尽头闪出一丝亮光。 出了甬道,...
    念衡阅读 1,095评论 0 12
  • 这里是杀手集训营。 楼房像极了教学楼,一排排的,粉红白调。 教学楼的左侧是一片林子,右侧则是一片广袤无垠的枯黄草原...
    隔壁的隔壁老Z阅读 255评论 0 1