#Codeforces:1A – Theatre Square

求得兩邊可用幾倍a覆蓋,再相乘算出需要的flagstone即可。

JavaScript(62 ms/0 KB)

(function main(){
    var inputs = readline().split(" ").map(function(x) { return parseInt(x); });
    var n = inputs[0], m = inputs[1], a = inputs[2];

    print(Math.ceil(n/a)*Math.ceil(m/a));
})();

C#(62 ms/2400 KB)

using System;
using System.Linq;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(new char[]{' '}).Select(x => int.Parse(x)).ToArray();
            int n = input[0], m = input[1], a = input[2];

            Console.WriteLine( (Int64)Math.Ceiling((double)n/a) * (Int64)Math.Ceiling((double)m/a) );
        }
    }
}