$vis$ 是一个 2 进制数
for(int i=vis; i; i=(i-1)&vis) foreach(i);
来源: http://www.bubuko.com/infodetail-3401453.html