日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

CF Theatre Square

發布時間:2025/3/20 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CF Theatre Square 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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


易知,n/a即為需要多少塊a,每一塊a都能完全用完,又知,n%a若不零,那么還需要再添加一塊,若為零則不需要。
所以總的塊數即為(n / a + (n % a) ? 1 : )) * (m / a + (m % a) ? 1 : 0) 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 5 int main(void) 6 { 7 long long n,m,a; 8 long long ans; 9 10 scanf("%lld%lld%lld",&n,&m,&a); 11 ans = (n / a + ((n % a) ? 1 : 0)) * (m / a + ((m % a) ? 1 : 0)); 12 printf("%lld\n",ans); 13 14 return 0; 15 }

?

轉載于:https://www.cnblogs.com/xz816111/p/4396858.html

總結

以上是生活随笔為你收集整理的CF Theatre Square的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。