Created
April 14, 2013 14:41
-
-
Save gauravvichare/5382975 to your computer and use it in GitHub Desktop.
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 surfa…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class theatre { | |
public static void main(String[] args) { | |
double n,m,a; | |
Scanner in = new Scanner(System.in); | |
n = in.nextDouble(); // accept width of theatre square | |
m = in.nextDouble(); //accept length of theatre square | |
a = in.nextDouble(); //accept side of flagstone | |
System.out.println((long)Math.ceil(n/a)*(long)Math.ceil(m/a) ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment