A1. ZEROAuthor: Alexander GeorgievDuring the women's parties Ellie and her friends happens theyplay a variety of games, often associated with alcohol (which is bad and you, as areasonable people should not do!). One of them is the following: five girls in rankcircle and each of them thinks of a number between one and thirty thousand. After, if two girls sitting together, have odd numbers, they can be removedone of them and drink shotche Baileys. The other option in the game's two girlsagain sitting next to each other that have random non-zero numbers (includingtwo odd) can divide them integer of 2 (i.e. ignoring the remainder) andshotche drink Rum. Only a couple girls can drink every round. Finalobjective of the game is numbers and the five girls become equal to zero (and theyare significantly drunk can safely start discussing boysclass). Because Eli did not find much sense in the game, she recorded of any round whichcouple girls drank and what. Our heroine asks how possiblesequences can be obtained (i.e., how many possible ways cangirls choose the order in which they drink and what) so that eventually all remain withnumbers zero. Help her write a program zero, that, giveninitial numbers of girls determines how many ways can proceedgame.InputA single line of input will be set five numbers 1 ≤ A1, A2,A3, A4, A5 ≤ 30 000 - initial numbers of each of the girls.ExitThe standard output the number of possible sequences of numbersthat Eli could write down. If no sequence could bereach five zeros, print 0. Since the potential result could bevery large display only the rest of his division at 1,000,000,007.Example:Input Output2 3 6 1 1 101 2 2 1 1 03 4 5 1 42406989 9367 6809 5635 4390 42424222Explanation:In the first example, one of the possible sequences is (3, 4) to drink Rum,then (5, 1) to drink Rum, then (1, 2) to drink Baileys, then (2, 3) to drink Rum, and finally(2, 3) to drink Rum. Note that the last step (2, 3) can drink Baileys,giving another sequence of 10 in reply. In the second example in anyand a way to drink girls finally becoming one of them will stay with one, the other will havezero.
đang được dịch, vui lòng đợi..
