![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
Reticent_Man
我本微末凡尘,可也心向天空。
展开
-
红与黑
描述有一间长方形的房子,地上铺了红色、黑色两种颜色的正方形瓷砖。你站在其中一块黑色的瓷砖上,只能向相邻的黑色瓷砖移动。请写一个程序,计算你总共能够到达多少块黑色的瓷砖。输入包括多个数据集合。每个数据集合的第一行是两个整数W和H,分别表示x方向和y方向瓷砖的数量。W和H都不超过20。在接下来的H行中,每行包括W个字符。每个字符表示一块瓷砖的颜色,规则如下1)‘.’:黑色的瓷砖;2)‘#’:白色的瓷砖...原创 2018-06-21 19:39:22 · 277 阅读 · 0 评论 -
A Knight's Journey
BackgroundThe knight is getting bored of seeing the same black and white squares again and again and has decided to make a journeyaround the world. Whenever a knight moves, it is two squares in one di...原创 2018-06-21 19:43:05 · 217 阅读 · 0 评论 -
骑士游历
题目描述:设有一个n*m的棋盘(2≤n≤50,2≤m≤50),在棋盘上有一个中国象棋马。规定:1)马只能走日字2)马只能向右跳问给定起点x1,y1和终点x2,y2,求出马从x1,y1出发到x2,y2的合法路径条数。输入:第一行2个整数n和m第二行4个整数x1,y1,x2,y2输出:方案数样例输入30 301 15 3 15样例输出2#include <iostream>using n...原创 2018-06-23 15:49:21 · 356 阅读 · 0 评论 -
n皇后
#include <iostream>#include <cmath>using namespace std;int n,count=0,hashtable[100]={false},a[100];void search(int index){ if(index==n+1) { count++; return ; } for(int i=1;i&...原创 2018-10-09 21:41:58 · 113 阅读 · 0 评论 -
“块”的个数
题目给出一个m*n的矩阵,矩阵中的元素为0或1.称位置(x,y)与其上下左右四个位置(x,y+1),(x,y-1),(x+1,y),(x-1,y)是相邻的。如果矩阵中有若干个1是相邻的(不必两两相邻),那么成这些1构成了一个“块”。求给定的矩阵中块的个数。输入样例6 70 1 1 1 0 0 10 0 1 0 0 0 00 0 0 0 1 0 00 0 0 1 1 1 01...原创 2018-11-08 20:03:15 · 253 阅读 · 0 评论