Let B=A+C where n+1A≤C<nA.
First, here is an informal sketch of the proof.
Lavaman's strategy: Use only safe intervals with nA+C−1 integers. The flea will start at position [1,C] from the left, which puts him at position [nA,nA+C−1] from the right. After n−1 jumps, he will still have nA−(n−1)(A+C)=A−(n−1)C>C distance to go, which is not enough for a big jump to clear the lava. Thus, he must do at least n jumps in the safe interval, but that's possible only with all small jumps, and furthermore is impossible if the starting position is C. This gives him starting position 1 higher in the next safe interval, so sooner or later the flea is going to hit the lava.
Flea's strategy: The flea just does one interval at a time. If the safe interval has at least nA+C integers in it, the flea has distance d>nA to go to the next lava when it starts. Repeatedly do big jumps until d is between 1 and CmodA, then small jumps until the remaining distance is between 1 and C, then a final big jump. This works as long as the first part does. However, we get at least n big jumps since ⌊(d−1)/A⌋ can never go down two from a big jump (or we'd be done doing big jumps), so we get n big jumps, and thus we are good if dmodA is in any of [1,C],[C+1,2C],…,[nC+1,(n+1)C], but that's everything. □
Let C=B−A. We shall write our intervals of lava in the form (Li,Ri]={Li+1,Li+2,…,Ri}, where Ri=Li+A and Ri−1<Li for every i≥1. We also let R0=0. We shall also represent a path for the flea as a sequence of integers x0,x1,x2,… where x0=0 and xj−xj−1∈{A,B} for every j≥0.
Now here is a detailed proof.
First, assume F<(n−1)A+B(=nA+C): we must prove that Lavaman has a winning strategy. Let Li=Ri−1+nA+C−1 for every i≥1. (Observe that nA+C−1≥F.)
means that xj∈/(Li,Ri] for all i,j≥1. For each i≥1, let
Mi=max{xj:xj≤Li},mi=min{xj:xj>Ri}, andJ(i)=max{j:xj≤Li}.
Also let m0=0. Then for i≥1 we have
Mi=xJ(i)andmi=xJ(i)+1.
Also, for every i≥1, we have
(a) mi=Mi+B (because Mi+A≤Li+A=Ri);
(b) Li≥Mi>Li−C (since Mi=mi−B>Ri−B=Li+A−B);
(c) Ri<mi≤Ri+C (since mi=Mi+B≤Li+B=Ri+C).
Mi+1=xJ(i+1)=xJ(i)+n+1≥xJ(i)+1+(n−1)A+B>Ri+nA+C=Li+1+1>Mi+1
which is a contradiction. This proves Claim 2.
xJ(i+1)+1i.e., mi+1=xJ(i)+n+2=xJ(i)+1+nA+B;=mi+nA+Bfor each i≥1.
Therefore
mi+1−Ri+1=mi+nA+B−(Ri+nA+C−1+A)=mi−Ri+1.
Hence
C≥mC+1−RC+1=m1−R1+C>C
which is a contradiction. Therefore no path for the flea avoids all the lava. We observe that Lavaman only needs to put lava on the first C+1 intervals.
Now assume F≥(n−1)A+B. We will show that the flea can avoid all the lava. We shall need the following result:
Claim 3: Let d≥nA. Then there exist nonnegative integers s and t such that sA+tB∈(d−C,d].
We shall prove this result at the end.
First, observe that L1≥nA. By Claim 3, it is possible for the flea to make a sequence of jumps starting from 0 and ending at a point of (L1−C,L1]. From any point of this interval, a single jump of size B takes the flea over (L1,R1] to a point in (R1,R1+C], which corresponds to the point xJ(1)+1(=m1) on the flea's path.
Now we use induction to prove that, for every i≥1, there is a path such that xj avoids lava for all j≤J(i)+1. The case i=1 is done, so
assume that the assertion holds for a given i. Then xJ(i)+1=mi∈(Ri,Ri+C]. Therefore
Li+1−mi≥Ri+F−(Ri+C)=F−C≥nA.
Applying Claim 3 with d=Li+1−mi shows that the flea can jump from mi to a point of (Li+1−C,Li+1]. A single jump of size B then takes the flea to a point of (Ri+1,Ri+1+C] (without visiting (Li+1,Ri+1]), and this point serves as xJ(i+1)+1. This completes the induction.
Proof of Claim 3: Let u be the greatest integer that is less than or equal to d/A. Then u≥n and uA≤d<(u+1)A. For v=0,…,n, let
zv=(u−v)A+vB=uA+vC.
Then
z0=uA≤d,
zn=uA+nC=uA+(n+1)C−C≥(u+1)A−C>d−C.
and zv+1−zv=C for v=0,…,n−1.
Therefore we must have zv∈(d−C,d] for some v in {0,1,…,n}. □