Let $A$ and $B$ be $n\times n$ matrices. Let $x$ be a scalar variable and define $D(x):=det(A+Bx)$. It can be easily shown by induction on $n$ that $D(x)$ is a polynomial of degree at most $n$. The problem is to find an explicit polynomial if the matrices are as of the following form (with $a\neq b$):
$$A= \begin{pmatrix} \lambda_1 & a & a & \dots & a \\ b & \lambda_2 & a & \dots & a \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ b & b & b & \dots & \lambda_n \end{pmatrix}$$
$$B= \begin{pmatrix} 1 & 1 & 1 & \dots & 1 \\ 1 & 1 & 1 & \dots & 1 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & 1 & \dots & 1 \end{pmatrix}$$
I already spotted an inductive pattern not really that useful: I found some regularity by calculating the determinant on the first column: the first term is $(\lambda_1+x)*D_{n-1}$ and the other terms are summations of $(b+x)(a+x)*D_{n-2}$ where every $D$ is called on submatrices with different $\lambda$ but it doesnt't really help for finding an explicit formulation. It seems to me at most useful for proving an already found polynomial is the right one.