CF1988B 题解
思路
显然,使用操作
代码
# 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, s1, s2;
string a;
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
while (t --) {
s1 = s2 = 0;
cin >> n >> a;
for (int i = 0; i < n; ++ i)
if (a[i] == '1')
++ s1;
else if (! i || a[i - 1] != '0')
++ s2;
cout << (s1 > s2 ? "Yes\n" : "No\n");
}
I AK IOI
}