HDU-1056 HangOver
Since the data is every small, you just need to loop and calculate until you find a answer that is bigger than the given number.
Since the data is every small, you just need to loop and calculate until you find a answer that is bigger than the given number.
You can easily see that the law of ciphers is that each letter moves 21 bits backward. The 26 letters form a circle to support the law. However, in the ascii code, the letters are not a circle so you need to judge separately.
This is a sorting problem, you can either use quick sort or bubble sort or other sorts.
Just estimate each number, if it is lower than 168, then this underpass is unable to be passed. If no number is less than 168 ,then there is no crash.
Turn the pseudo code in to real code. And an important thing is that the value of i and j is not fixed that i < j. So we have to judge the value of i j.
The range of the number is very small, only 0 to 9, store all the factorial of n, and then calculate then one by one.
This is an easy problem and you just need to stimulate the hole process.
The easiest problem
First, you get the fist pair of numbers. And then find a pair of numbers that is totally different with the first pair.
To make the most product, you just need to change all numbers to negative first. And then find the smallest number and make it positive.