当前位置:网站首页>【Codeforces】 A. Computer Game
【Codeforces】 A. Computer Game
2022-07-27 17:57:00 【tsunaa】
A. Computer Game
The question :
To give you one 2*N Lattice of , from (1,1) Go to the (2,n), You can walk up, down, left and right , You can also walk sideways , Every time I go x,y Step no more than 1. There will be obstacles on the way , Ask if you can walk to (2,n). It is known that (1,1) and (2,n) There are no obstacles .
1 Stands for obstacles ,0 It means there is no .
Examples :

Ideas :
Just started to use dfs Write , then t 了 . Later, I found it was very simple after reading the solution :
As long as you encounter up and down 1 Of , You can't go . Such as :
0100 0010 0111
0100 perhaps 0110 perhaps 1010
So just go through it , See if there is any str(1)(i) == str(2)(i) that will do .
AC Code :
#include<bits/stdc++.h>
using namespace std;
int t, n;
int flag;
string a[2];
int main(){
cin >> t;
while(t--){
cin >> n;
flag = 1;
a[0].clear(); a[1].clear();
cin >> a[0] >> a[1];
for(int i = 0; i < n; i++)
if( a[0][i] == '1' && a[1][i] == '1') flag = 0;
if(!flag) cout << "NO" << endl;
else cout << "YES" << endl;
}
}
边栏推荐
- How far can invisible orthodontics go under the tuyere?
- Chery omenda is also too similar to Chang'an uni-t, but does it look like it? Is the product power like it?
- Following the example of IE, is the decline of Firefox inevitable?
- Compilation and testing of raspberry pie driver code
- Gods at dusk, "cat trembles" bid farewell to the big V Era
- wallys/DR882-Qualcomm-Atheros-QCA9882-2T2R-MIMO-802.11ac-Mini-PCIe-Wi-Fi-Module-5G-high-power.
- 【obs】x264_ encoder_ Encode encoding output PTS DTS and framesize
- Mysql database defines cursor in trigger
- JS to realize the right-click menu bar function
- 详解二叉树之堆
猜你喜欢

Because the employee set the password to "123456", amd stolen 450gb data?

奇瑞欧萌达也太像长安UNI-T了,但长得像,产品力就像吗?

How difficult the interview is! I was forced to survive the six rounds of interview of ant financial! Almost out (interview resumption)

JSP custom tag (bottom)

Initial polymorphism

Lichuang EDA - layout and inspection of schematic diagram (III)

Soul 1: why is es more suitable for complex condition search than MySQL?

微信小程序 云函数批量删除多条数据 Error: errCode: -502005 database collection not exists

Explain the pile of binary trees in detail

How to resolve the public domain name to the intranet IP server -- quickly resolve the domain name and map the Internet access
随机推荐
How to restrict root remote login so that ordinary users have root privileges
Lichuang EDA - layout and inspection of schematic diagram (III)
20 years ago, he was Ma Yun's biggest enemy
工信部再治数据安全,网易易盾“隐私合规”守住企业经营底线
TCP的连接状态标识 (SYN, FIN, ACK, PSH, RST, URG)
js实现右键菜单栏功能
Some suggestions for writing original technical articles
KMP template - string matching
初识多态
Notes on standardized management of "ancestral warehouse" of meituan meal
An analysis of CPU explosion of a smart logistics WCS system in.Net
知物由学 | 易盾移动端同构实践,几步改善官网交互体验
公网域名如何解析到内网IP服务器——快解析域名映射外网访问
Taishan Office Technology Lecture: word strange paragraph borders
【Codeforces】 A. Computer Game
【单片机】2.3 AT89S52的CPU
#yyds干货盘点# 面试必刷TOP101:链表内指定区间反转
Initial polymorphism
C语言怎么学?这篇文章给你完整答案
面试好难啊!蚂蚁金服的六轮面试我是强撑过来!差点OUT(面试复盘)