The second week of the first tournament title

Title: Capital Bolan Theaterplatz rectangular, the size of n × m. In the anniversary of the city, we decided to lay the square with a square granite slabs. The size of each stone plate is a ×. How many stone paved plaza requires a minimum? You can cover a surface larger than the Theater Square, but the square must be covered. It does not allow broken slate. Both sides of the slate should be parallel to the sides of the square. Comprising a first input line in the three positive integer: n-, m and a (1≤n, m, a≤109) , a desired number of output slate
Solution: Enter m, n, a, according to the compiler, if m / a is not an integer, it will take only integer part, if not an integer 1 should increase, the final output

#include <iostream>
using namespace std;
int main()
{
	int m, n, a,b,c;
	while (cin >> m >> n >> a)
	{
		if (m%a == 0) b = m / a;
		else b = m / a + 1;
		if (n%a == 0) c = n / a;
		else c = n / a + 1;
		cout << b * c << endl;
	}
}

Guess you like

Origin blog.csdn.net/weixin_43981315/article/details/85039164