Answer
$$W = 87.5{\text{Joules}}$$
Work Step by Step
$$\eqalign{
& {\text{From the information we have:}} \cr
& F\left( x \right) = 250{\text{N}}{\text{ }}\left( {{\text{Variable force}}} \right) \cr
& x = 30{\text{cms}}{\text{ }}\left( {{\text{Variable distance}}} \right) \cr
& x = 0.3{\text{m}} \cr
& \cr
& {\text{Using Hooke's Law to find the spring constant }}k \cr
& F\left( x \right) = kx \cr
& 250 = k\left( {0.3} \right) \cr
& k = \frac{{250}}{{0.3}} \cr
& k = \frac{{2500}}{3} \cr
& F\left( x \right) = kx \cr
& F\left( x \right) = \frac{{2500}}{3}x \cr
& \cr
& {\text{The work required is }} \cr
& W = \int_a^b {F\left( x \right)} dx \cr
& {\text{Stretching the spring 20cm to 50cm, }}\underbrace {\left[ {0.2{\text{m}},0.5m} \right]}_{\left[ {a,b} \right]} \cr
& W = \int_{0.2}^{0.5} {\frac{{2500}}{3}x} dx \cr
& {\text{Integrating}} \cr
& W = \frac{{2500}}{3}\left[ {\frac{1}{2}{x^2}} \right]_{0.2}^{0.5} \cr
& W = \frac{{1250}}{3}\left[ {{x^2}} \right]_{0.2}^{0.5} \cr
& W = \frac{{1250}}{3}\left[ {{{\left( {0.5} \right)}^2} - {{\left( {0.2} \right)}^2}} \right] \cr
& W = \frac{{175}}{2}{\text{N}} \cdot {\text{m}} \cr
& W = 87.5{\text{Joules}} \cr} $$