CF1994B 题解
思路
我们设
代码
# include <bits/stdc++.h>
# define I return
# define AK 0
# define IOI ;
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, n;
string a, b;
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
while (t --) {
cin >> n >> a >> b;
for (int i = 0; i < n; ++ i) {
if (a[i] == '1')
break ;
if (a[i] != b[i])
goto no;
}
cout << "Yes\n";
continue ;
no:
cout << "No\n";
}
I AK IOI
}