B. You’re a teapot.
Notice that N\le 100 , so you can use the algorithm with a complexity of O(n^3) .
Enumerate all possible substrings and check the filling value of it. Find the maximum one among all these.
Warning :
- The filling value is \frac{x-2}{|t|-2} rather than \frac{x}{|t|}
- When N \le 2 , there is no substring with a length greater or equal to 3 so you should also directly skip it.
My experience :
1st Submission
2nd Submission
3rd Submission
4th Submission
5th Submission
(5)