hdu 1312 Red and Black
来源:互联网 发布:simpson算法流程图 编辑:程序博客网 时间:2024/06/18 11:58
在学姐的帮助下总算的写出来了,感谢今夕学姐的教导
#include<iostream>#include<cstring>using namespace std;int n,m,sum;char mapp[21][21]={1};int visit[21][21];int dir[4][2]={{-1,0},{0,-1},{1,0},{0,1}};void dfs(int x,int y){//int xx=x,yy=y;visit[x][y]=1;for(int i=0;i<4;i++) {int xx,yy;xx=x+dir[i][0];yy=y+dir[i][1];if(xx<0||xx>=n||yy<0||yy>=m||(visit[xx][yy]==1)||mapp[xx][yy]=='#') continue;sum++;dfs(xx,yy);}}int main(){while(cin>>m>>n&&n&&m){//memset(visit,0,sizeof(visit));fill(&visit[0][0],&visit[21][0],0);sum=0;int x,y;for(int i=0;i<n;i++){for(int j=0;j<m;j++){cin>>mapp[i][j];if(mapp[i][j]=='@') x=i,y=j;}}//cout<<visit[0][0];dfs(x,y);cout<<sum+1<<endl;}return 0;}
0 0
- Red and Black hdu 1312
- HDU 1312 Red and Black
- HDU 1312 Red and Black
- hdu 1312 Red and Black
- Hdu 1312 - Red and Black
- hdu-1312-Red and Black
- hdu 1312Red and Black
- hdu 1312 Red and Black
- hdu - 1312 - Red and Black
- hdu 1312 Red and Black
- hdu 1312 Red and Black
- HDU-1312(red and black)
- HDU 1312 Red and Black
- hdu 1312 Red and Black
- HDU 1312 Red and Black
- hdu 1312 Red and Black
- hdu 1312 Red and Black
- hdu 1312 Red and Black
- 让一个东西在main方法之后执行
- Mysql命令大全
- 前端作品仿2015/3/21百度首页面
- C#第三方控件SpreadsheetControl的使用
- vi查找替换命令详解
- hdu 1312 Red and Black
- 23个MySQL常用查询语句
- Java中的==和equals区别
- Team Explorer 使用教程1
- 10、匿名内部类实现接口,lambda表达式实现函数式接口
- 二进制乘法原理
- Team Explorer使用教程2
- 解决修改text里面value失败问题
- Spring AOP (二)