Can anyone help me with this problem I Volume of revolution from ACM ICPC 2014 Dhaka site. My idea was to consider the false volume as slice numbered polaygonal pyramids and calculated their volume. The true volume will come from integration of pi*y(x)^2. But I got wrong answer. Here is my code Thanks is Advance.

I am also having same doubt, please look at my code Can somebody post their solution or idea? Thanks

A friend of mine showed me this problem (he saw it in this post) and I was able to solve it. Finding the actual volume is applying normal integration. Just need to write our own function that squares a polynomial and then integrates it.

As for the approximation, we can find the volume of a single slice and multiply at the end by number of slices since they are all the same. We compute the volume of each stack independently. This can be done by integration as well. Imagine the integration as a sum of infinitely many triangles with a vertex on the x-axis and other two vertices on the surface of our shape. Note that the angle formed at the vertex that lies on the x-axis is the same for all triangle and is equal to 360 / #of slices. Formula for the area of a triangle at a particular x coordinate can be found so we can integrate.

Here is my code. Feel free to ask questions, this is somewhat difficult to visualize. Solution