CF1A Theatre Square

· · 个人记录

题意翻译

用 a×a a \times a a×a 的石板覆盖 n×mn \times m n×m 的长方形广场,允许石板覆盖的区域超出广场,不允许打破石板,石板的两侧应平行于广场两侧,要求覆盖完广场所需的石板数量最少是多少

输入输出格式

输入格式:

The input contains three positive integer numbers in the first line: n,m n,m n,m and a a a ( 1<=n,m,a<=109 1<=n,m,a<=10^{9} 1<=n,m,a<=10 9 ).

输出格式:

Write the needed number of flagstones.

参考程序

#include<iostream>  
using namespace std;  

int main(){  
    int n, m, a;  
    cin>>n>>m>>a;  
    long long i, j;  
    i = n/a;  
    j = m/a;  
    if(n%a){  
        i++;  
    }  
    if(m%a){  
        j++;  
    }  
    long long sum=i*j;  
    cout<<sum<<endl;  
    return 0;  
}