Codeforces 1 a theatre Square

Source: Internet
Author: User
Tags integer numbers

A. Theatre Square

Theatre Square in the capital city of Berland have a rectangular shape with the size n x m meters. On the occasion of the city ' s anniversary, a decision is taken to pave the square with square granite flagstones. Each flagstone is of the size a x a.

What's 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 have to be covered. It's not a allowed to break the flagstones. The sides of flagstones should is 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

Java large number class basic operations

ImportJava.util.*;Importjava.math.*; Public classMain { Public Static voidMain (string[] args) {BigInteger zero=NewBigInteger ("0"); BigInteger One=NewBigInteger ("1"); Scanner SC=NewScanner (system.in);  while(Sc.hasnext ()) {BigInteger n=Sc.nextbiginteger (); BigInteger m=Sc.nextbiginteger (); BigInteger a=Sc.nextbiginteger ();                  BigInteger x, y; if(N.remainder (a). Equals (zero)) x=N.divide (a); Elsex=N.divide (a). Add (one); if(M.remainder (a). Equals (zero)) Y=M.divide (a); Elsey=M.divide (a). Add (one);
System.out.println (x.multiply (y)); } }}

Codeforces 1 a theatre Square

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.