#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
char g[][];
int x, y, ans;
int dx[]={,,-};
int dy[]={,,-};
bool sscanf()
{
char tmp[];
scanf("%d%d",&x,&y);
if(x== && y==) return false;
for(int i = ; i <= x; i++)
{
scanf("%s",tmp);
for(int j = ; j <= y; j++)
g[i][j] = tmp[j-];
}
ans = ;
return true;
}
void find(int xi, int yi)
{
if(g[xi][yi]=='@')
{
g[xi][yi]='*';
for(int i = ; i < ; i++)
for(int j = ; j < ; j++)
find(xi+dx[i],yi+dy[j]);
}
return;
}
int main()
{
// freopen("in.in","r",stdin);
// freopen("out.txt","w",stdout);
while(sscanf())
{
for(int i = ; i <= x; i++)
for(int j = ; j <= y; j++)
{
if(g[i][j]=='@')
{
ans++;
find(i, j);
}
}
printf("%d\n",ans);
} return ;
}

[kuangbin带你飞]专题一 简单搜索 - L - Oil Deposits的更多相关文章

  1. [kuangbin带你飞]专题一 简单搜索 题解报告

    又重头开始刷kuangbin,有些题用了和以前不一样的思路解决.全部题解如下 点击每道题的标题即可跳转至VJ题目页面. A-棋盘问题 棋子不能摆在相同行和相同列,所以我们可以依此枚举每一行,然后标记每 ...

  2. [kuangbin带你飞]专题一 简单搜索(回顾)

    A - 棋盘问题 POJ - 1321 注意条件:不能每放一个棋子,就标记一行和一列,我们直接枚举每一行就可以了. AC代码: #include<iostream> #include< ...

  3. [kuangbin带你飞]专题一 简单搜索 - E - Find The Multiple

    //Memory Time //2236K 32MS #include<iostream> using namespace std; ]; //保存每次mod n的余数 //由于198的余 ...

  4. [kuangbin带你飞]专题一 简单搜索 棋盘问题

    题来:链接https://vjudge.net/problem/OpenJ_Bailian-132 J - 棋盘问题 1.题目: 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别. ...

  5. [kuangbin带你飞]专题一 简单搜索

            ID Origin Title 454 / 1008 Problem A POJ 1321 棋盘问题   328 / 854 Problem B POJ 2251 Dungeon Ma ...

  6. [kuangbin带你飞]专题一 简单搜索 回顾总结

    第二题:bfs,忘了将queue清空. 第三题:bfs,记得使用vis数组,防止重复入队

  7. 迷宫问题 POJ - 3984 [kuangbin带你飞]专题一 简单搜索

    定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, ...

  8. [kuangbin带你飞]专题一 简单搜索 Find a way HDU - 2612

    Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year ...

  9. Catch That Cow POJ - 3278 [kuangbin带你飞]专题一 简单搜索

    Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. ...

随机推荐

  1. delphi与javascript互通

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  2. AcWing 143. 最大异或对 01字典树打卡

    在给定的N个整数A1,A2……ANA1,A2……AN中选出两个进行xor(异或)运算,得到的结果最大是多少? 输入格式 第一行输入一个整数N. 第二行输入N个整数A1A1-ANAN. 输出格式 输出一 ...

  3. flutter duplicate symbol '_GetDirectoryOfType' in:

    ld: warning: directory not found for option '-F/Users//codingProject/vipidea-app/ios/Runner/SuperPla ...

  4. TeleportPoint可瞬移的目标位置

    TeleportPoint.png 最外部的组件: Animation: 包含了该装置的几个动画Teleport Point: 点传送的脚本 teleport_marker_mesh: 外部的圆柱形光 ...

  5. CoreDump analyse

    1 Found core dump files: -rw------- 1 root root 1019645952 Dec 14 01:56 core.7002-rw------- 1 root r ...

  6. vbs 之 解决打开Excel文件格式与扩展名指定格式不一致的问题

    ' Q:解决打开Excel文件格式与扩展名指定格式不一致的问题' A: 使用工作簿saveAs时,往往忽略掉它的第二个参数FileFormat,添加即可. 比如: set bookDiff = oEx ...

  7. 剑指offer——49礼物的最大价值

    题目描述 在一个m*n的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于0).你可以从棋盘的左上角开始拿格子里的礼物,并每次向左或者向下移动一格,知道到达棋盘的右下角.给定一个棋盘及其上面 ...

  8. 20140610 PP中可以绘制表格;PPT组合之后再加效果

    PPT绘制表格(行人检测的cell和block) 动画:组合之后再加效果

  9. keepalived高可用haproxy负载均衡varnish缓存wordpress的动静分离(第一次配置成功)

    haproxy和nginx都可以作为七层和四层反代服务器对外提供服务,此文通过haproxy和keealived配置varnish搭建wordpress的动静分离站点 一.实验环境 五台虚拟机: ha ...

  10. 整合phoenix4.6.0-HBase-1.0到cdh5..4.7 编译phoenix4.6源码 RegionServer 宕机

    Phoenix 集成HBase Phoenix 版本:phoenix-4.6.0-HBase-1.0 源码下载地址: http://apache.cs.uu.nl/phoenix/phoenix-4. ...