Using stringstream can help make the problem easy. Using stringstream to traverse the sentence word by word.
The point of this problem is to input a string with spaces.
Only two conditions exist that make it impossible
The middle two numbers' absolute difference is the answer. Because you can give the first to array1 and second to array2 and third to array1...
Calculate the number of zeros and sum. If there is all zeros, the answer is n + 1;
Stimulate the walking process. Using map, int> to store the points. (The second parameter of map stands for the times of the move, that is the position in the string where it meets a certain points)
This is stimulating the process. First, spend the money of multiples of ten. Spend the most at once. Second, add up the rest and feedback money.
If there is no odd number, then no matter how to move it will stay all even, so it's NO.
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)