zoukankan      html  css  js  c++  java
  • cf--------(div1)1A. Theatre Square

    A. Theatre Square
    time limit per test
    2 seconds
    memory limit per test
    64 megabytes
    input
    standard input
    output
    standard output

    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 test(s)
    Input
    6 6 4
    Output
    4
    只想说。。。。。。。。。。。。。。
    代码:
     1 #include<iostream>
     2 using namespace std;
     3 int main()
     4 {
     5   int n,m,a,b,c;
     6   while(scanf("%d%d%d",&n,&m,&a)!=EOF){
     7      c=n/a;
     8      b=m/a;
     9     if(n%a) c++;
    10      if(m%a) b++;
    11      cout<<(long long)c*b<<endl;
    12  }
    13   return 0;
    14 }
    View Code
  • 相关阅读:
    bzoj2732[HNOI2012]射箭
    poj1474 Video Surveillance
    bzoj3167[HEOI2013]SAO
    hdu2296 Ring
    bzoj2119 股市的预测
    bzoj2244[SDOI2011]拦截导弹
    bzoj3502[PA2012]Tanie Linie(最大k区间和)
    vijos1859[TJOI2014]电源插排
    比较SQL查询性能 语句
    什么是高内聚低耦合
  • 原文地址:https://www.cnblogs.com/gongxijun/p/3920665.html
Copyright © 2011-2022 走看看