Skip to content

Commit 3479995

Browse files
committed
codeForces_1A_A_Theatre_Square
1 parent 17c66c8 commit 3479995

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* 思路:矩形用小正方形填充,只需行和列取整就行了。
3+
* 注意陷阱,不要用 int32,否则结果打印不了最大 10^18 这样的大数
4+
* AC:
5+
* Time:31 ms Memory:0 KB
6+
*
7+
*/
8+
#include<stdio.h>
9+
#include<map>
10+
#include<utility>
11+
12+
using namespace std;
13+
14+
int main()
15+
{
16+
int n, m, a;
17+
long long row = 0, col = 0, ans = 0;
18+
scanf("%d%d%d", &n, &m, &a);
19+
if (n % a == 0) {
20+
col = n / a;
21+
}
22+
else {
23+
col = n / a + 1;
24+
}
25+
if (m % a == 0) {
26+
row = m / a;
27+
}
28+
else {
29+
row = m / a + 1;
30+
}
31+
32+
ans = row * col;
33+
printf("%lld", ans);
34+
return 0;
35+
}

0 commit comments

Comments
 (0)