摘要:
//简单的的搜索,找到能扩充的最大步数#includeusing namespace std;const int maxn = 20 + 5;int dirx[4] = {0, 0, -1, 1};int diry[4] = {-1, 1, 0, 0};int n, m, ans;int sx, sy;char map[maxn][maxn];bool used[maxn][maxn];int dfs(int x, int y){ int px, py; int max = 0; used[x][y] = 1; ans++; for(int i=0; i= 1 && px = 阅读全文
摘要:
//打表记录1到40的素数表#include#includeusing namespace std;const int maxn = 40;int n;int used[maxn];int s[maxn];bool v[maxn];void prime(){ memset(v, 1, sizeof(v)); for(int j = 2; j >n){ s[0] = 1; cout<<"Case "<<c++<<":"<<endl; memset(used, 0, sizeof(used)); dfs( 阅读全文