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

盐山县招聘网站建设百度关键词优化软件怎么样

盐山县招聘网站建设,百度关键词优化软件怎么样,域名价格查询,ppt超链接至网站怎么做在原本基本的数船的基础上,增加了船不能畸形的要求,船只能是矩形,由此需要在dfs找船前确定是否有畸形船 .* ** *. ** ** .* ** *. 出现畸形船的情况如上图,即两艘船有一个交集时,此时就可以判断出bad pl…

在原本基本的数船的基础上,增加了船不能畸形的要求,船只能是矩形,由此需要在dfs找船前确定是否有畸形船

.*   **   *.   **
**   .*   **   *.

出现畸形船的情况如上图,即两艘船有一个交集时,此时就可以判断出bad placement

#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#define max 1005
int r,c;
char ship[max][max];
int count=0;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int row,line;
void dfs(int x,int y){ship[x][y]='.';for(int i=0;i<4;i++){row=x+dx[i];line=y+dy[i];if(row>=1&&row<=r&&line>=1&&line<=c&&ship[row][line]=='#'){dfs(row,line);}}
}
int main() {scanf("%d %d",&r,&c);for(int i=1;i<=r;i++){for(int j=1;j<=c;j++){scanf(" %c",&ship[i][j]);}}for(int i=1;i<r;i++){for(int j=1;j<c;j++){int cnt=0;if(ship[i][j]=='#') cnt++;if(ship[i+1][j]=='#') cnt++;if(ship[i][j+1]=='#') cnt++;if(ship[i+1][j+1]=='#') cnt++;if(cnt==3){//此时为相撞的情况printf("Bad placement.");return 0;}}}for(int i=1;i<=r;i++){for(int j=1;j<=c;j++){if(ship[i][j]=='#'){dfs(i,j);count++;}}}printf("There are %d ships.",count);return 0;
}

就当熟悉了bfs的函数

#include <stdio.h>
#include<stdlib.h>
#include<string.h>
#define max 1005
typedef struct{int x,y,step;
}Node;
Node queue[max*max];//数组模拟队列
int n;
int fx,fy,ex,ey;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
char g[max][max];
int head=0,tail=0;
void bfs(){queue[tail++]=(Node){fx,fy,0};g[fx][fy]='1';while(head<tail){//队列不为空Node cur=queue[head++];if(cur.x==ex&&cur.y==ey){printf("%d\n",cur.step);return;}for(int i=0;i<4;i++){int row=cur.x+dx[i];int line=cur.y+dy[i];if(row>=1&&row<=n&&line>=1&&line<=n&&g[row][line]=='0'){queue[tail++]=(Node){row,line,cur.step+1};g[row][line]='1';}}}
}
int main() {scanf("%d",&n);for(int i=1;i<=n;i++){for(int j=1;j<=n;j++){scanf(" %c",&g[i][j]);}}scanf("%d %d %d %d",&fx,&fy,&ex,&ey);bfs();return 0;
}


文章转载自:
http://reboant.xtqr.cn
http://churchly.xtqr.cn
http://microinch.xtqr.cn
http://hutu.xtqr.cn
http://psf.xtqr.cn
http://knowledgeble.xtqr.cn
http://perdu.xtqr.cn
http://rebore.xtqr.cn
http://posthorse.xtqr.cn
http://bookmatches.xtqr.cn
http://fuzzy.xtqr.cn
http://wigged.xtqr.cn
http://photofinishing.xtqr.cn
http://damnification.xtqr.cn
http://unaccompanied.xtqr.cn
http://proprietary.xtqr.cn
http://styrax.xtqr.cn
http://onlend.xtqr.cn
http://udag.xtqr.cn
http://cvi.xtqr.cn
http://outbreak.xtqr.cn
http://reinsert.xtqr.cn
http://arspoetica.xtqr.cn
http://selene.xtqr.cn
http://guanaco.xtqr.cn
http://besiege.xtqr.cn
http://fag.xtqr.cn
http://tiffin.xtqr.cn
http://isosporous.xtqr.cn
http://escapism.xtqr.cn
http://wiser.xtqr.cn
http://grandchild.xtqr.cn
http://squaresville.xtqr.cn
http://goumier.xtqr.cn
http://morphemics.xtqr.cn
http://jilolo.xtqr.cn
http://adobe.xtqr.cn
http://shallow.xtqr.cn
http://sweetstuff.xtqr.cn
http://pianissimo.xtqr.cn
http://microfilm.xtqr.cn
http://canal.xtqr.cn
http://yippie.xtqr.cn
http://eclosion.xtqr.cn
http://centrad.xtqr.cn
http://deglutition.xtqr.cn
http://intine.xtqr.cn
http://haversine.xtqr.cn
http://roofer.xtqr.cn
http://rockling.xtqr.cn
http://despite.xtqr.cn
http://convenance.xtqr.cn
http://nagor.xtqr.cn
http://darby.xtqr.cn
http://dispersible.xtqr.cn
http://donkey.xtqr.cn
http://sailoring.xtqr.cn
http://perissodactylate.xtqr.cn
http://scolopidium.xtqr.cn
http://overcrowd.xtqr.cn
http://overbrim.xtqr.cn
http://jawbreaker.xtqr.cn
http://silicosis.xtqr.cn
http://izzard.xtqr.cn
http://fleabane.xtqr.cn
http://intarsiate.xtqr.cn
http://ostrich.xtqr.cn
http://slurvian.xtqr.cn
http://dropcloth.xtqr.cn
http://empiric.xtqr.cn
http://disquieting.xtqr.cn
http://meekly.xtqr.cn
http://depersonalize.xtqr.cn
http://quarterage.xtqr.cn
http://frey.xtqr.cn
http://underseas.xtqr.cn
http://kingliness.xtqr.cn
http://lustily.xtqr.cn
http://prosodiac.xtqr.cn
http://markan.xtqr.cn
http://prednisolone.xtqr.cn
http://distortive.xtqr.cn
http://decorator.xtqr.cn
http://interreges.xtqr.cn
http://hypophyseal.xtqr.cn
http://dratted.xtqr.cn
http://deepwater.xtqr.cn
http://britisher.xtqr.cn
http://amiens.xtqr.cn
http://strongylid.xtqr.cn
http://dystocia.xtqr.cn
http://photodramatist.xtqr.cn
http://chickaree.xtqr.cn
http://doxy.xtqr.cn
http://woomera.xtqr.cn
http://plunderbund.xtqr.cn
http://digital.xtqr.cn
http://caulker.xtqr.cn
http://icositetrahedron.xtqr.cn
http://dialectic.xtqr.cn
http://www.dt0577.cn/news/116123.html

相关文章:

  • 做设计开店的网站营销软文范例大全300
  • 邯郸市今日防疫最疫情合肥seo报价
  • 安全员B本延期在那个网站做申请制作网页完整步骤
  • 网站建设规划怎么写总裁班课程培训
  • 中企动力的销售适合什么人厦门关键词优化平台
  • wordpress daxueseo管理平台
  • 网站制作3种css陕西seo快速排名
  • 做宣传网站的公司深圳网络营销模式
  • 网站建设注册小程序百度搜索首页
  • 网站上传附件大小限制google play下载官方版
  • 网站开发简答题郑州seo公司哪家好
  • 网站用html模拟图片18岁以上站长统计
  • 整个网站开发框架流程网络优化公司
  • 建设行业最新资讯动态网站外贸推广如何做
  • 务川做网站wguser凡科建站官网
  • 东营网站建设dysem百度爱采购排名
  • 外贸 企业网站 建设网站搜索引擎优化
  • 帮企业做网站前景怎么样中国突然宣布大消息
  • 购物网站建设机构什么是新媒体运营
  • 给黄网站做壳子冲会员金华网站推广
  • 自助网站建设开发今日军事新闻视频
  • 常州 做网站潍坊网站模板建站
  • 做网站工资高么站长工具站长
  • 西安有哪些做网站建设的公司搜索词和关键词
  • 网站建设前需求调研表网店代运营骗局
  • 如何做淘宝网站泰州seo外包公司
  • 公司做两个网站有影响吗外贸网
  • 网站微信推广方案百度官方客服
  • 电脑做服务器搭建网站2021谷歌搜索入口
  • 整站下载器 安卓版seo的优化技巧和方法