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

有没有帮人做机械设计的网站网站入口百度

有没有帮人做机械设计的网站,网站入口百度,有趣的网站游戏,手机怎样建个人网站题干#xff1a; 求每个*能够到达的格子数量#xff0c;只有.可以走#xff08;四个方向扩展#xff09;#xff0c;结果mod 10#xff0c;替换 * 后输出。 Input The first line contains two integers n, m (1 ≤ n, m ≤ 1000) — the number of rows and co…题干 求每个*能够到达的格子数量只有.可以走四个方向扩展结果mod 10替换 * 后输出。 Input The first line contains two integers n, m (1 ≤ n, m ≤ 1000) — the number of rows and columns in the field. Each of the next n lines contains m symbols: . for empty cells, * for impassable cells. Output Print the answer as a matrix as described above. See the examples to precise the format of the output. Examples Input 3 3 *.* .*. *.*Output 3.3 .5. 3.3Input 4 5 **..* ..*** .*.*. *.*.*Output 46..3 ..732 .6.4. 5.4.3Note In first example, if we imagine that the central cell is empty then it will be included to component of size 5 (cross). If any of the corner cell will be empty then it will be included to component of size 3 (corner). 解题报告 直接对每个.进行搜索看连通块然后对每一个*直接求答案就行了注意不要算重复所以需要set去判重。因为有可能四个方向属于同一个联通块所以不判重就会加四次 AC代码 #includecstdio #includeiostream #includealgorithm #includequeue #includemap #includevector #includeset #includestring #includecmath #includecstring #define ll long long #define pb push_back #define pm make_pair using namespace std; const int MAX 1000 5; char maze[MAX][MAX]; int ans[MAX][MAX]; bool vis[MAX][MAX]; int f[MAX*MAX]; int num[MAX*MAX]; int n,m; int nx[4] {0,1,0,-1}; int ny[4] {1,0,-1,0}; int getf(int v) {return v f[v] ? v : f[v] getf(f[v]); } void merge(int u,int v) {int t1 getf(u);int t2 getf(v);f[t2] t1; } int get(int x,int y) {return (x-1)*m y; } void go(int x,int y) {for(int k 0; k4; k) {int tx x nx[k];int ty y ny[k];if(tx 1 || tx n || ty 1 || ty m) continue;if(maze[tx][ty] * || vis[tx][ty]) continue;merge(get(x,y),get(tx,ty));vis[tx][ty] 1;go(tx,ty);} } int main() {cinnm;for(int i 0; in*m; i) {f[i] i;}for(int i 1; in; i) {scanf(%s,maze[i]1);}for(int i 1; in; i) {for(int j 1; jm; j) {if(maze[i][j] . vis[i][j] 0) {vis[i][j] 1;//别忘这步虽然这题不会WA但是不写是错的。go(i,j);} }}for(int i 1; in; i) {for(int j 1; jm; j) {if(maze[i][j] *) continue;num[getf(get(i,j))];}}for(int i 1; in; i) {for(int j 1; jm; j) {if(maze[i][j] .) ans[i][j] .;else {int cnt 0;setint ss;for(int k 0; k4; k) {int tx i nx[k];int ty j ny[k];if(maze[tx][ty] *)continue;if(tx 1 || tx n || ty 1 || ty m) continue;ss.insert(getf(get(tx,ty)));}auto it ss.begin();for(;it!ss.end();it) cnt num[*it];ans[i][j] cnt;}}}for(int i 1; in; i) {for(int j 1; jm; j) {if(maze[i][j] .) printf(.);else printf(%d,(ans[i][j]1)%10);}puts();}return 0 ; }
http://www.pierceye.com/news/256511/

相关文章:

  • 网站建设首选公司wordpress需要mysql
  • 织梦 旅游网站模板深圳公司招牌制作
  • PHP网站开发如何建立vipwordpress页面伪静态
  • 主题公园旅游景区网站建设网站后台图片模板
  • 慈溪网站建设慈溪WordPress点击文章显示404
  • 网站建设与seo网站开发项目总结范文
  • 做竞彩网站代理犯法么建站公司 网站
  • 浙江建设证书查询seo服务公司深圳
  • 长沙协会网站设计专业服务医疗信息化软件公司排名
  • 北京网站制作一般多少钱黑色网站欣赏
  • 广州建设工程造价管理站wordpress获取文章title
  • 免费购物网站源码网站开发的论文引言
  • 商城网站开发需要哪些人员本机建的网站打开却很慢
  • 网站建设哪专业学会python做网站
  • vs怎么添加图片做网站地方门户网站管理系统
  • 三亚做网站的公司科技网站推荐
  • 电商网站运维怎么做自己做网站创业
  • seo有哪些网站集团公司网站 案例
  • 传媒大学附近网站建设公司天津市工程建设公众信息网官网
  • 关于网站建设与维护的参考文献家装设计费用多少钱一平方
  • 网站建设与管理专业概述网站建设报价费用是多少
  • asp医院网站源码破解版北京企业做网站报价
  • 个人做电商网站赚钱吗门业网站模板
  • 企业产品微网站收费吗wordpress移服务器改域名
  • 原创文章网站网站建设团队介绍
  • WordPress建站详细过程安康建设网站
  • 仿视频网站开发wordpress下载文件
  • 专业的个人网站建设哪家建筑施工企业专职安全生产管理员
  • 企业网站模板php全球网站排名前100
  • 1688网站可以做全屏吗有哪些网站是织梦做的