The maximum potential energy that the spring connecting blocks A and B can have as a consequence of collision of block C with A is (ignore any friction). Assume the collision between C and A to be elastic.
mv204
‘C’ comes to rest immediately after collision. A starts moving with v0. At the instant of maximum compression or elongation, relative velocity of A with respect to B would be zero and hence A and B would be moving with a common velocity. From conservation of momentum, mv0=2mv⇒v=v02.
Hence, from conservation of energy: (P.E)max=12mv20−12(2m)(v02)2=12mv20−14mv20=14mv20