Условия: Работа на ведущих производителей Xerox, кабинете с пн. В день 3-4. Самовывоз Нежели для с пн.
These fantastical elements, however, probably have their roots in the real world. While defeating the Hydra was an act of great heroism and teamwork, its inspiration may have been more grounded. The second of the famous twelve labors of Hercules was to kill a horrible monster called the Lernean Hydra. The Hydra was a many-headed serpent. Most artists depicted it as having six heads, while some writers elaborated the story to give it as many as fifty. One of the most consistent elements of the legend was that the Hydra possessed a particularly deadly venom.
Not only were its bite and spit toxic, but even the vapors given off by the monster as it slept could kill most men. The Hydra also regenerated its heads. Early accounts claimed that when one head was cut off another grew back, while later writers claimed that two or even three heads would replace each that was removed.
One head, however, could not be killed. Hercules was sent to the swamps outside of Lerna to kill the monster. According to some accounts, the Hydra had only been brought there by Hera specifically to challenge her stepson. The hero was accompanied by his nephew Iolaus, who was often said to be his chariot driver and squire.
As he began to fight it, however, he realized it was harder to defeat than he had thought it would be. A giant crab emerged to attack him as well as the Hydra. In the time it took him to destroy one skull, any previously-injured heads had grown back. As the fight wore on, Hercules made no progress against the serpent. It was Iolaus who figured out how his uncle could win the fight. Perhaps inspired by Athena, he picked up one of the flaming torches they had used to find their way through the swamps.
As soon as one of the heads was removed, he used the torch to cauterize the wound. By acting so quickly, the neck was closed before a new head, or set of heads, could grow from the open wound. The final head was removed, leaving the body to fall dead in the marsh. Because its venom was still a danger, Hercules buried the immortal head in a deep pit where no one was likely to dig it up.
Before he left, however, the hero made good use of the poison. He dipped his arrows in it, and for the rest of his life he would use these poisoned weapons to kill some of his most fearsome foes. Because Iolaus had helped in the endeavor, King Eurythemus declared that the second labor of Hercules had not been completed.
He would ultimately complete twelve labors instead of the original ten to make up for those the king and Hera nullified. The region of Lerna was known for its marshes and lakes. In Greek mythology, this also made it a portal to the Underworld. Entrances to the Underworld were thought to exist in many parts of the living world, usually in remote and dangerous locations where few people would stumble across them.
The swamps of Lerna made it an ideal place for such a gateway. In addition to natural dangers and obstacles, the Greeks also believed that portals to the realm of Hades were guarded by terrible monsters. The hazards of remote locations were represented by beasts who would kill anyone who strayed too far off the beaten path.
The Hydra was typical of one of these Underworld guardians. Cerberus , for example, shared the feature of having many heads. Guardians in mythology were often described in this way with the explanation that this allowed them to be continuously watchful. Snakes, too, were associated with the Underworld. Many monsters in Greek mythology, from the giant Typhon to the snake-haired Gorgon , had serpentine elements.
The Hydra thus fits the type of an Underworld guardian, but it also represents a very real danger. The mythology of ancient Greece, and of Hercules in particular, features many monsters with obvious real-world parallels. Most of the beasts and monsters fought by Hercules were exaggerated versions of animals found in the wilds of Greece and Asia Minor.
While lions are now extinct in Europe, for example, Asian lions could be found in Greece until shortly before the classical period. Greek colonists in Asia Minor and North Africa would have been even more familiar with such predators.
The Hydra is an exaggerated form of a venomous snake. Notice that until the very last hit, the hit and growth can occur at the same time. Meaning we can just hit the hydra down, and check if it can be killed in one hit. For instance for the code returns 2, 0, 1, 3 we can check that this is correct by doing. Indeed, this returns 62 which is a number of heads we can strike of in the next turn.
Notice that this already takes into consideration the growing back of heads. We could also have used mathematics to obtain the results, this is somewhat fast for very large inputs. I would recommend going for one of the two other suggestions first though! This is known as a Diophantine equation which sympy knows how to solve. Amongst the nerds we say that the solution can be written as a parametric equation. So all we have do to is use sympy to solve the equation, and then check if we can find a particular solution with integer coefficients.
Noe 0: The explanation above is not quite right. Due to how you choose to calculate the hits and regrowth hits before regrowth. We really need to hit the Hydra until it is one hit away from death. Note 1: that the switch minimize in the code below attempts to find the shortest or fastest way to kill the Hydra.
If you only any solution set this boolean to false. Note: 2: the code below is merely a suggestion. There are several improvements that could and should be made to the code below. Such as, but not limited to. Adding PEP typing hints. The recurse solution would also benefit from adding restrictions from the general solution.
As an example we have. For the first hydra. This could make the looping faster. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Killing a hydra Ask Question. Asked 8 months ago. Active 8 months ago. Viewed times. Improve this question. If the hydra has 20 heads can you cut off 26?
Add a comment. Active Oldest Votes. You have many inconsistencies in your code that suggests you are not using any type of autoformater for your code. This is strongly suggested. I like to use black , but there are many other variants. Structure your code using functions Remove unused imports using imports. Time only the relevant parts. Suggestion 1 [We only want to know if the Hydra can be killed!
The hydra can be killed in one hit, if its heads is in hits Then we just have to iterate over all possible hit values and return the first one that matches. Suggestion 3 [Mathematics] We could also have used mathematics to obtain the results, this is somewhat fast for very large inputs.
Hercules killing the Hydra of Lerna / Херкулес убива хидрата от Лерна. Done. Comment. 1, views. 0 faves. 0 comments. Taken on April 3, You are facing a nine-headed hydra. Your flaming longsword cuts five heads in each swipe (no more, no less), which will kill a five-headed hydra, but a larger. Wait a few seconds after fight starts, dodge fire in the mean time. Turn the winter orb on. Then kill the other heads, then kill blue head.