摘要:代码不写就手生啊。。。 注意输入, 二维数组 #include
#include
#include
#include
#include
using namespace std;
const int maxn=100+5;
char field[maxn][maxn];
int n,m;
void input()
{ scanf("%d%d", &n, &m); for(...
阅读全文
摘要:The Settlers of Catan Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness....
阅读全文
摘要:Meta-Loopless Sorts Background Sorting holds an important place in computer science. Analyzing and implementing various sorting algorithms forms an important part of the education of most comput...
阅读全文
摘要:// 题意:输入一个迷宫,从*开始遍历,把可达点标记为字符# 注意迷宫边界不规则,要用strlen判断。 #include#include#include#include#includeusing namespace std;const int maxn = 100 + 5;char maze[maxn][maxn];int dr[]={0, 0, -1, 1};int dc[]=...
阅读全文
摘要:// 题意:给一个图案,其中'.'表示背景,非'.'字符组成的连通块为筛子。每个筛子里又包含两种字符,其中'X'组成的连通块表示筛子上的点 // 统计每个筛子里有多少个“X”连通块 思路:两次dfs //思路:先dfs找包含X和*的区域,再在*的区域中dfs X的个数#include#include#include#include#include#includeusing n...
阅读全文
摘要:技巧:遍历8个方向 for(int dr = -1; dr #include#include#include#includeusing namespace std;const int N=102;char buf[N][N];int m, n;int cnt;int dr[]={0, 0, 1, 1, 1, -1, -1, -1};int dc[]={1, -1, -1, 0, 1,...
阅读全文
摘要:注意点: 空树情况处理。 循环时候可以先判断符合条件,再递减: while(i-1>=0 && buf[r+2][i-1]=='-') i--; #include#include#include#include#includeusing namespace std;const int N=200+2;char buf[N][N];int n;//递归遍历并且输出以字符buf[...
阅读全文