心生一計

Idiom

 * 1) to suddenly have an idea; to suddenly hatch a scheme in one's head