当前位置: 首页 > news >正文

网站开发开发需求文档做米业的企业网站

网站开发开发需求文档,做米业的企业网站,wordpress弹窗,南昌网站建设公司行情洛谷P1101单词方阵:用sta存字符串,for找到‘y的位置,然后dfs对字符串用for进行一个一个的判断,不符合就return,下面再用for进行book标记,能执行下面的for说明上面没有return,所以说明找到&#…

洛谷P1101单词方阵:用sta存字符串,for找到‘y'的位置,然后dfs对字符串用for进行一个一个的判断,不符合就return,下面再用for进行book标记,能执行下面的for说明上面没有return,所以说明找到,book标记字符串长度就行,然后for+if判断book为true就输出,不然就输出*就行。

#include<iostream>
#include<cstring>
using namespace std;
const int N = 105;
int n;
string sta = "yizhong";
char ch[N][N];
bool book[N][N];
int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
void dfs(int x, int y, int xd, int yd){int a = x + xd, b = y + yd;for(int i = 1; i < 7; i++){if(sta[i] != ch[a][b])return;a += xd;b += yd;}for(int i = 0; i < 7; i++){book[x][y] = true;x += xd;y += yd;} 
}
int main(){cin >> n;for(int i = 1; i <= n; i++){for(int j = 1; j <= n; j++){cin >> ch[i][j];}}for(int i = 1; i <= n; i++){for(int j = 1; j <= n; j++){if(ch[i][j] == 'y'){for(int k = 0; k < 8; k++) dfs(i, j, dx[k], dy[k]);} } }for(int i = 1; i <= n; i++){for(int j = 1; j <= n; j++){if(book[i][j]) cout << ch[i][j];else cout << '*' ;}cout << endl;}return 0;
}

洛谷P2404自然数的拆分问题:DFS

#include<iostream>
using namespace std;
int n, m;
int p[15] = {1};
void dfs(int x){for(int i = p[x - 1]; i <= m; i++){if(i == n)continue;p[x] = i;m -= i;if(m == 0){for(int j = 1; j < x; j++){cout << p[j] << '+';}cout << p[x] << endl;}else dfs(x + 1);m += i;}
}
int main(){cin >> n;m = n;dfs(1);return 0;
}

洛谷P1596一道BFS,求连通块数量。

#include<iostream>
#include<queue>
using namespace std;
const int N = 105;
int n, m;
bool st[N][N];
char ch[N][N];
int ans;
int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
typedef pair<int, int> PII;
void bfs(int a, int b){queue<PII> q;q.push({a, b});st[a][b] = true;while(q.size()){auto t = q.front();q.pop();int x = t.first, y = t.second;for(int i = 0; i < 8; i++){int xx = x + dx[i], yy = y + dy[i];if(xx >= 1 && xx <= n && yy >= 1 && yy <= m && !st[xx][yy] && ch[xx][yy] == 'W'){st[xx][yy] = true;q.push({xx, yy});}}}ans++;
}
int main(){cin >> n >> m;for(int i = 1; i <= n; i++){for(int j = 1; j <= m; j++){cin >> ch[i][j];}}for(int i = 1; i <= n; i++){for(int j = 1; j <= m; j++){if(ch[i][j] == 'W' && !st[i][j])bfs(i, j);}}cout << ans << endl;return 0;
}

洛谷P1162填色:相当于围墙加水,里面的是水也就是2, 外面的为0,外面从0,0开始把围墙外的数通过BFS都给标记成3,然后是3就输出0,原来的围墙1不变,然后围墙里面本来是0,的就输出2。

#include<iostream>
#include<queue>
using namespace std;
const int N = 35;
int a[N][N];
int n;
bool st[N][N];
int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0};
typedef pair<int, int> PII; 
void bfs(){queue<PII> q;q.push({0, 0});st[0][0] = true;while(q.size()){auto t = q.front();q.pop();int x = t.first, y = t.second;for(int i = 0; i < 4; i++){int xx = x + dx[i], yy = y + dy[i];if(xx >= 0 && xx <= n + 1 && yy >= 0 && yy <= n + 1 && !st[xx][yy] && a[xx][yy] == 0){a[xx][yy] = 3;st[xx][yy] = true;q.push({xx, yy});}}}
}
int main(){cin >> n;for(int i = 1; i <= n; i++){for(int j = 1; j <= n; j++){cin >> a[i][j];}}bfs();for(int i = 1; i <= n; i++){for(int j = 1; j <= n; j++){if(a[i][j] == 3) cout << 0 << ' ';else if(a[i][j] == 1) cout << 1 << ' ';else cout << 2 << ' '; }cout << endl;}return 0;
}

http://www.yayakq.cn/news/617271/

相关文章:

  • 陕西城乡建设厅网站天眼查河南建设网站公司
  • 网站上的用户注册怎么做的公司营销型网站建设策划书
  • 漯河做网站推广建站公司最新报价
  • app和手机网站如何提高网站流量
  • 站内关键词自然排名优化学市场营销后悔死了
  • 企业定制网站建设公司哪家好做景观素材有哪几个网站
  • 晋城门户网站建设wordpress搭建后域名打不开
  • 免费网站怎么申请wordpress去掉评论邮箱
  • 电脑去哪里建设网站社交营销
  • 访问量大的网站选择多少流量的服务器何时免费psd模板网站
  • 织梦免费自适应网站模板是做网站设计好还是杂志美编好
  • wordpress可以建立商城英文网站首页优化
  • 温州市网站制作多少钱域名cn是个什么网站
  • 麻涌网站仿做万网主体新增网站备案需要是滴么
  • 上海松江建设银行网站企业网站做seo的优势
  • 杭州的设计网站wordpress加qq
  • 做游戏和做网站哪个难宁德市住房和城乡建设局网站打不开
  • 企业门户网站建设机构深圳品牌做网站公司哪家好
  • 网站设计排行榜前十网站做广告如何做帐
  • 做网站的集群方案门户网站怎么创建
  • 手机端网站开发教程如何制作一个游戏app
  • 免费做网站平台小程序备案流程
  • 旅游网站建设规划方案怎样查看网站建设时间
  • 企业采购网站有哪些哈尔滨市招投标信息网
  • ios开发者账号多少钱婚纱网站目录优化
  • 2017淘宝客网站怎么做深圳怎么注册公司网站
  • 贷款超市网站开发龙井网站建设
  • 哪些网站设计的高大上市场营销策划名词解释
  • 郑州做网站那家好nas wordpress备案
  • 学什么可以做网站衡水网站制作费用