Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Algorithm Problem(C++ solution)

Algorithm Problem(C++ solution)

Scheduled Pinned Locked Moved C / C++ / MFC
c++cssadobealgorithmshelp
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nirvikprantor
    wrote on last edited by
    #1

    Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
    time to keep a plane on runway. If airplane delay time > runway delay time than airplane
    needs to take out from a runway, then it is considered as missed and starts from again
    from a runway. You need to find out the minimum total delay for particular input. First
    input line is number of runways. Second input line is delay of each runway.
    Third input line is capacity of each runway to accommodate planes. Forth input line is
    total number of planes. Fifth input line is maximum delay an airplane can afford. If it
    exceed the runway delay time it is miss and it needs to start from again from a runway.
    You need to show how you managed the runways as output as well.
    Examples:(All are from user input)
    5
    2 2 3 5 7
    2 2 2 2 2
    8
    1 1 1 1 2 2 3 3
    Answer= 3

    calculetion:(For another Example)
    2 2 3 5 7 (runways delay times)
    ____________
    1 1 1 5 3 (Air planes Delay times are less or equal
    1 2 2 0 0 than runways delay)
    __________
    1sec -0 0 0 4 2
    1sec -0 1 1 3 1
    1sec -0 0 0 2 0
    1sec -0 0 0 1 0
    1sec -0 0 0 0 0
    ________________
    Dealay Time=(1+1+1+1+1)sec
    =5 second
    Answer=5

    OriginalGriffO S L 3 Replies Last reply
    0
    • N nirvikprantor

      Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
      time to keep a plane on runway. If airplane delay time > runway delay time than airplane
      needs to take out from a runway, then it is considered as missed and starts from again
      from a runway. You need to find out the minimum total delay for particular input. First
      input line is number of runways. Second input line is delay of each runway.
      Third input line is capacity of each runway to accommodate planes. Forth input line is
      total number of planes. Fifth input line is maximum delay an airplane can afford. If it
      exceed the runway delay time it is miss and it needs to start from again from a runway.
      You need to show how you managed the runways as output as well.
      Examples:(All are from user input)
      5
      2 2 3 5 7
      2 2 2 2 2
      8
      1 1 1 1 2 2 3 3
      Answer= 3

      calculetion:(For another Example)
      2 2 3 5 7 (runways delay times)
      ____________
      1 1 1 5 3 (Air planes Delay times are less or equal
      1 2 2 0 0 than runways delay)
      __________
      1sec -0 0 0 4 2
      1sec -0 1 1 3 1
      1sec -0 0 0 2 0
      1sec -0 0 0 1 0
      1sec -0 0 0 0 0
      ________________
      Dealay Time=(1+1+1+1+1)sec
      =5 second
      Answer=5

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      When you posted this yesterday in QA: How to solve this problem[^] You posted it together with two very different code fragments "you wrote" but couldn't get working, and were encouraged to use the debugger to fix them. Now, you're posting the question again with no code and asking for an algorithm "to solve it". We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in! Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did. And please, don't tell us you "wrote the code" because it's pretty clear from yesterday's post that you found something on the internet and hoped it would magically meet all your homework criteria...

      Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      J 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        When you posted this yesterday in QA: How to solve this problem[^] You posted it together with two very different code fragments "you wrote" but couldn't get working, and were encouraged to use the debugger to fix them. Now, you're posting the question again with no code and asking for an algorithm "to solve it". We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in! Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did. And please, don't tell us you "wrote the code" because it's pretty clear from yesterday's post that you found something on the internet and hoped it would magically meet all your homework criteria...

        Sent from my Amstrad PC 1640 Never throw anything away, Griff Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

        J Offline
        J Offline
        Joe Woodbury
        wrote on last edited by
        #3

        There's a pun somewhere in all of this, solve it!

        1 Reply Last reply
        0
        • N nirvikprantor

          Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
          time to keep a plane on runway. If airplane delay time > runway delay time than airplane
          needs to take out from a runway, then it is considered as missed and starts from again
          from a runway. You need to find out the minimum total delay for particular input. First
          input line is number of runways. Second input line is delay of each runway.
          Third input line is capacity of each runway to accommodate planes. Forth input line is
          total number of planes. Fifth input line is maximum delay an airplane can afford. If it
          exceed the runway delay time it is miss and it needs to start from again from a runway.
          You need to show how you managed the runways as output as well.
          Examples:(All are from user input)
          5
          2 2 3 5 7
          2 2 2 2 2
          8
          1 1 1 1 2 2 3 3
          Answer= 3

          calculetion:(For another Example)
          2 2 3 5 7 (runways delay times)
          ____________
          1 1 1 5 3 (Air planes Delay times are less or equal
          1 2 2 0 0 than runways delay)
          __________
          1sec -0 0 0 4 2
          1sec -0 1 1 3 1
          1sec -0 0 0 2 0
          1sec -0 0 0 1 0
          1sec -0 0 0 0 0
          ________________
          Dealay Time=(1+1+1+1+1)sec
          =5 second
          Answer=5

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          - where are the planes at the start: somewhere at the airport, at a runway, or in the air? - what are the times when planes are scheduled to arrive or take off? If not times, what is the order? If not order, is there any other restriction about the sequence? - what does delay(?) time mean for a plane? Is it the maximum time it can wait at the airport, or remain in the air? If so, when does the time start counting? Or does that time only start ticking when on a runway? - what does delay(?) time mean for a runway? What is it's effect? When does it start? - what do you mean by runway capacity? Typically I'd say the capacity of any runway is exactly 1, as there can't be two planes on the same runway at the same time! But clearly you mean something else. Explain! - the goal is to optimize a time for the airport - which time is that?

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          1 Reply Last reply
          0
          • N nirvikprantor

            Airport is divided to many Runways. Each runway has a mixed fixed delay amount of
            time to keep a plane on runway. If airplane delay time > runway delay time than airplane
            needs to take out from a runway, then it is considered as missed and starts from again
            from a runway. You need to find out the minimum total delay for particular input. First
            input line is number of runways. Second input line is delay of each runway.
            Third input line is capacity of each runway to accommodate planes. Forth input line is
            total number of planes. Fifth input line is maximum delay an airplane can afford. If it
            exceed the runway delay time it is miss and it needs to start from again from a runway.
            You need to show how you managed the runways as output as well.
            Examples:(All are from user input)
            5
            2 2 3 5 7
            2 2 2 2 2
            8
            1 1 1 1 2 2 3 3
            Answer= 3

            calculetion:(For another Example)
            2 2 3 5 7 (runways delay times)
            ____________
            1 1 1 5 3 (Air planes Delay times are less or equal
            1 2 2 0 0 than runways delay)
            __________
            1sec -0 0 0 4 2
            1sec -0 1 1 3 1
            1sec -0 0 0 2 0
            1sec -0 0 0 1 0
            1sec -0 0 0 0 0
            ________________
            Dealay Time=(1+1+1+1+1)sec
            =5 second
            Answer=5

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Do you work for Boeing?

            The Master said, 'Am I indeed possessed of knowledge? I am not knowing. But if a mean person, who appears quite empty-like, ask anything of me, I set it forth from one end to the other, and exhaust it.' ― Confucian Analects

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups