My issue
include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t–) {
int n;
cin >> n;
string s;
cin >> s;
if(s==“1” || s==“10”)
{
cout<<“NO”<<endl;
}
else{
int cnt = count(s.begin(), s.end(), ‘1’);
if (cnt <= 3) {
cout << “YES\n”;
} else {
cout << “NO\n”;
}
}
}
return 0;
}…please tell me error
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
string s;
cin >> s;
if(s=="1" || s=="10")
{
cout<<"NO"<<endl;
}
else{
int cnt = count(s.begin(), s.end(), '1');
if (cnt <= 3) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
}
return 0;
}
Problem Link: SUMPOW Problem - CodeChef