0001 #include "queen_brute_force_1/queen.h" 0002 0003 void place3Queens() { //3ʺ֦㷨 0004 int solu[3]; //ⷨ 0005 for ( solu[0] = 0; solu[0] < 3; solu[0]++ ) 0006 if ( !collide ( solu, 0 ) ) 0007 for ( solu[1] = 0; solu[1] < 3; solu[1]++ ) 0008 if ( !collide ( solu, 1 ) ) 0009 for ( solu[2] = 0; solu[2] < 3; solu[2]++ ) 0010 if ( !collide ( solu, 2 ) ) { 0011 nSolu++; displaySolution ( solu, 3 ); 0012 } 0013 }