分子团&&Programming Robots

7 篇文章 1 订阅

两个都是一类,bfs灌输题就是求有几个二维的联通块,当然dfs和并查集也可以完成
1.分子团,就是对于!0的地方进行灌水
2.Programming Robots,每个不是#的地方进行灌水,然后统计每个联通块里面有几个R

inline void bfs(int x,int y)
{
    ans=0;
    node st;st.x=x;st.y=y;
    vis[st.x][st.y]=1;
    q.push(st);
     
    while(!q.empty())
    {
        node k=q.front();q.pop();
        if(a[k.x][k.y]=='R')ans++;
        for(int i=0;i<4;i++)
        {
            int xx=k.x+dx[i];
            int yy=k.y+dy[i];
            if(!vis[xx][yy]&&a[xx][yy]!='#'&&xx>=1&&xx<=n&&yy>=1&&yy<=m)
            {
         
                vis[xx][yy]=1;
                node ne;ne.x=xx;ne.y=yy;ne.tep=k.tep+1;
                q.push(ne);
            }
        }
    }
    tot=max(tot,ans);
}
inline void bfs(int x,int y)
{
    ans++;
    node st;st.x=x;st.y=y;
    vis[st.x][st.y]=1;
    q.push(st);
    while(!q.empty())
    {
        node k=q.front();q.pop();
        for(int i=0;i<4;i++)
        {
            int xx=k.x+dx[i];
            int yy=k.y+dy[i];
            if(!vis[xx][yy]&&a[xx][yy]!='0'&&xx>=1&&xx<=n&&yy>=1&&yy<=m)
            {
                vis[xx][yy]=1;
                node ne;ne.x=xx;ne.y=yy;ne.tep=k.tep+1;
                q.push(ne);
            }
        }
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Start programming robots NOW! Learn hands-on, through easy examples, visuals, and code This is a unique introduction to programming robots to execute tasks autonomously. Drawing on years of experience in artificial intelligence and robot programming, Cameron and Tracey Hughes introduce the reader to basic concepts of programming robots to execute tasks without the use of remote controls. Robot Programming: A Guide to Controlling Autonomous Robots takes the reader on an adventure through the eyes of Midamba, a lad who has been stranded on a desert island and must find a way to program robots to help him escape. In this guide, you are presented with practical approaches and techniques to program robot sensors, motors, and translate your ideas into tasks a robot can execute autonomously. These techniques can be used on today’s leading robot microcontrollers (ARM9 and ARM7) and robot platforms (including the wildly popular low-cost Arduino platforms, LEGO® Mindstorms EV3, NXT, and Wowee RS Media Robot) for your hardware/Maker/DIY projects. Along the way the reader will learn how to: Program robot sensors and motors Program a robot arm to perform a task Describe the robot’s tasks and environments in a way that a robot can process using robot S.T.O.R.I.E.S. Develop a R.S.V.P. (Robot Scenario Visual Planning) used for designing the robot’s tasks in an environment Program a robot to deal with the “unexpected” using robot S.P.A.C.E.S. Program robots safely using S.A.R.A.A. (Safe Autonomous Robot Application Architecture) Approach Program robots using Arduino C/C++ and Java languages Use robot programming techniques with LEGO® Mindstorms EV3, Arduino, and other ARM7 and ARM9-based robots. Table of Contents Chapter 1 What Is a Robot Anyway? Chapter 2 Robot Vocabularies Chapter 3 RSVP: Robot Scenario Visual Planning Chapter 4 Checking the Actual Capabilities of Your Robot Chapter 5 A Close Look at Sensors Chapter 6 Programming the Robot’s Sensors Chapter 7 Programming Motors and Servos Chapter 8 Getting Started with Autonomy: Building Your Robot’s Softbot Counterpart Chapter 9 Robot SPACES Chapter 10 An Autonomous Robot Needs STORIES Chapter 11 Putting It All Together: How Midamba Programmed His First Autonomous Robot Chapter 12 Open Source SARAA Robots for All!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值