This problem is used in private contest:814
逻辑相关运算