DWITE '07 R1 #2 - Cubes in a Pyramid

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, October 2007, Problem 2

A pyramid is to be constructed out of stone cubes, 1 meter in length each. The pyramid will have a square base, and will be completely solid. Given the dimensions for the length of the base, and the height of the pyramid, and assuming that no material is wasted, calculate the minimum number of cube stones required to construct a pyramid of the supplied dimensions.

The input file will contain two lines with one real value on each line, L and H; 0.00L,H100.00 representing the Length of the base and the Height of the pyramid to be constructed.

The output file will contain a single integer, representing the minimum number of blocks required for the construction.

Sample Input

Copy
10.0
5.0

Sample Output

Copy
167

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments


  • 0
    oshirbd  commented 48 days ago

    import math a = float(input()) b = float(input())

    V = 1/3 a**2 b

    print(math.ceil(V))