During the Spring and Autumn Period, an army from the State of Qi confronted one from the State of Lu. After the first roll of drums from the Qi side to summon Lu to battle, the Lu ruler wanted to attack. But his counsellor Cao Gui said, 'We should wait until the third drum roll, sire.' After the Qi side had beaten the drums three times, the Lu army attacked and defeated the Qi army. After the battle, the king asked Cao Gui the reason for his odd advice. Cao Gui answered, 'Fighting needs spirit. Their spirit was aroused by the first roll or the drums, but was depleted by the second. And it was completely exhausted by the third. We started to attack when their spirit was exhausted. That's why we won.'
This idiom later meant to get something done with one sustained effort.