For the biggest, only if there is one person who answer the wrong can he go through the most questions. So the longest time he can go through, the largest sum of money he can get.
In the first example test case, the nearest floor with an open restaurant would be the floor 4.
So the value of b should only be 9,99,999...(each digit is consists of 9)
First of all I tried the violent way. Time limit exceeded. So I tried mathematic way.
Let's stimulate the situation by ourselves first.
Using C++ Sort.
Turn then into positive numbers and sort. And for each unit in array, if it’s negative originally, turn it back to negative.
As you can easily see, for each point tower[i][j] , it has two parent points, warning...
No tricks but you need to be very careful or you will not be able to make it.
Using C++ 11 features. reverse. Another way is is find the middle of the string and travers from both side. Compare one by one.
As you can see from the picture, for each unit, there is...
Just stimulate the rule of clock time addition.
This problem has a regular pattern. Let me show you.
a and b each mod 100 and the answer a + b mod 100
This problem seems like a very huge problem, however, the answers have some certain regular pattern.