CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Dec 2009
    Posts
    8

    I need an algorith to solve this problem

    I have a task:

    There is a screen size MxN and it is covered with cuboids with different height(there are MxN cuboids) . The water is poured out on it. I have to calculate capacity of water which remain in cuboids. I have to find few algoriths and compare time of calculation. I'll be grateful for quick help!!!

  2. #2
    Join Date
    Apr 2011
    Posts
    2

    Re: I need an algorith to solve this problem

    can you draw an algorithm for your task ?
    I did not understand what you need to do...

  3. #3
    Join Date
    Dec 2009
    Posts
    8

    Re: I need an algorith to solve this problem

    I have an area like that in the picture. Thera are MxN squares (they are the same height and legth) symbolized a cuboide with different height (empty inside). The water is poured in this area and I have to calculate the capacity of the water which stay in this area.
    Attached Images Attached Images  

  4. #4
    Join Date
    Nov 2008
    Location
    England
    Posts
    748

    Re: I need an algorith to solve this problem

    Are all the cuboids filled to capacity with water?
    If so surely its just adding up the volume of each of the specific cuboids with the volume of each cuboid being given by the formula length * width * height, if all cuboids are the same size and filled to capacity its simply number_of_cuboids * length * width * height.
    Get Microsoft Visual C++ Express here or CodeBlocks here.
    Get STLFilt here to radically improve error messages when using the STL.
    Get these two can't live without C++ libraries, BOOST here and Loki here.
    Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
    Always use [code] code tags [/code] to make code legible and preserve indentation.
    Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured