|
|||
AlphaGoPeter is a math genius. He is very quick at computing a complicated problem, in particular, he is very good at integer multiplication. Given a sequence of integer numbers, he can quickly tell you the products of all subsequences of the given integers. But now Peter has a challenger. Larry Page, the cofounder of Google, got jealous of Peter's ability, hence he has ordered Google AlphaGo to compete in a game with Peter. The game is rather simple: each player gets a sequence of integers, then each playes has to determine the maximum product value of all possible subsequences of consecutive numbers from the given sequence. The winner is the one that gives the answer first. AlphaGo is very good at this game with its advanced algorithm of the combination of machine learning and tree search techniques. Write a program to help Peter win this game. The program must find the required product value quickly. Warning: be careful when you write the program since the input sequence can be quite long. Input SpecificationThe input contains sequences of numbers. Each number will have at most 5 digits. There will be at most 100 numbers in each sequence. Each sequence starts in a new line and may continue in several subsequent lines. Each sequence ends with the number –999999 (which is not a part of the sequence). Output SpecificationFor each test case, output in one line the maximum product value of all possible subsequences of consecutive numbers from the given sequence. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |