| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我的转换函数(懒得写位运算,使用bitset)int flip(int b1, int i, int j)
{
bitset<16> b(b1);
b[i*4+j].flip();
i>0 && b[(i-1)*4+j].flip();
i<3 && b[(i+1)*4+j].flip();
j>0 && b[i*4+(j-1)].flip();
j<3 && b[i*4+(j+1)].flip();
if (b.count() == 1 || b.count() == 15) return -1;//我想到的一个简单剪枝
return b.to_ulong();
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator