hit the nail on the head

Be exact or accurate / Ken is smart. He hit the nail on the head when he said the best idea and it worked.