2026年2月港梦杯高考数学模拟试卷 #14
在一个 $4\times 4$ 的正方形网格中等可能选取三个不同的方格,则这三个方格两两之间没有公共边的概率为 _____.
答案 $\dfrac{69}{140}$.
解析 选取三个不同的方格的方法数为 $\dbinom{16}3=560$,如图间隔染色.

若选取的三个方格同色,则满足要求,方法数为\[2\dbinom83=112.\]
若选取的三个方格不同色,考虑一蓝两白,按蓝格的位置为角格、边格和内格分类,方法数为\[2\binom 62+2\binom 52+2\binom 42=82,\] 因此选取的三个方格不同色时符满足要求的方法数为 $164$.
综上所述,所求概率为\[\frac{112+164}{560}=\frac{69}{140}.\]
地图中的每一个位置都是独一无二的,三个人从地图中各选择一个格子占位:一共有16*15*14 = 3360种可能,怎么可能 是540?
下面的程序显示,三个人占位,一共有1656种可能选择不相邻的格子。
设计程序运行,一共有1656种可能,C++源代码如下:
```
#include
struct Point{int x; int y;};
void test_select_3_square_without_neighbor(){
int count = 0;
char map[4][4]={};
Point p[3]={};
auto isOnMap = [&](int x, int y){
return 0<=x && x<4 && 0<=y && y<4;
};
auto isEmpty = [&](int x, int y){
if(isOnMap(x,y) && map[y][x]!= 0)return false;
if(isOnMap(x+1,y) && map[y][x+1]!= 0)return false;
if(isOnMap(x-1,y) && map[y][x-1]!= 0)return false;
if(isOnMap(x,y+1) && map[y+1][x]!= 0)return false;
if(isOnMap(x,y-1) && map[y-1][x]!= 0)return false;
return true;
};
auto dump = [&](){
printf("[number = %d]\n", count);
for(int y = 0; y<4;y++){
for(int x =0;x<4;x++){
map[y][x] ? printf("%c", map[y][x]): printf("#");
}
printf("\n");
}
};
auto checkABC = [&](const Point& a, const Point& b, const Point& c){
map[a.y][a.x] = 'a';
if(isEmpty(b.x,b.y)){
map[b.y][b.x] = 'b';
if(isEmpty(c.x,c.y)){
++count;
map[c.y][c.x] = 'c';
dump();
map[c.y][c.x] = 0;
}
map[b.y][b.x] = 0;
}
map[a.y][a.x] = 0;
};
for(int a = 0; a<4;a++){
for(int b = 0;b<4;b++){
p[0].x = b;
p[0].y = a;
for(int c = 0; c<4;c++){
for(int d =0;d<4;d++){
p[1].x = d;
p[1].y = c;
for(int e = 0; e<4;e++){
for(int f =0;f<4;f++){
p[2].x = f;
p[2].y = e;
checkABC(p[0], p[1], p[2]);
}
}
}
}
}
}
}
int main() {
test_select_3_square_without_neighbor();
return 0;
}
```