Codeforces 1A Theatre Square

长和宽除以边长后向上取个整。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _1A
{
    class Program
    {
        static Int64 calc(Int64 i, Int64 a)
        {
            return i / a + (i % a == 0 ? 0 : 1);
        }

        static void Main(string[] args)
        {
            Int64[] ints = Console.ReadLine().Split().Select(i => Int64.Parse(i)).ToArray();
            Int64 w = calc(ints[0], ints[2]);
            Int64 h = calc(ints[1], ints[2]);

            Console.WriteLine(w * h);
        }
    }
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注