If we know the starting point of the battleship and its speed, then we can determine its position at any time after 12 PM.
There are countably many combinations (X, Y) of starting point and speed. We can order them in the following way:
(0, 0) – starting point 0, speed 0;
(0, 1) – starting point 0, speed +1;
(1, 0) – starting point 1, speed 0;
(0, -1) – starting point 0, speed -1;
(1, 1) – starting point 1, speed +1;
(-1, 0) – starting point -1, speed 0;
(0, 2) – starting point 0, speed +2;
(1, -1) – starting point 1, speed -1;
(-1, 1) – starting point -1, speed 1;
(2, 0)- starting point 2, speed 0,
and so on. Of course, we can choose the ordering in many different ways.
Now we can start exhausting all possibilities one after another. First we assume the combination is (0, 0), calculate where the battleship would be at midnight during the first day and shoot there. Then we assume the combination is (0, 1), calculate where the battleship would be at midnight during the second day and shoot there. If we continue like this, eventually we will hit the battleship.