LEBOMBS - Editorial

(he solved it: CodeChef: Practical coding for everyone)

2 Likes

Can you tell me what is wrong in this code?
#include
#include<bits/stdc++.h>
#include
using namespace std;
#define ll long long int
int main(){
int t;
cin>>t;
int n;

string s;
while(t–){
cin>>n;
cin>>s;

for(int i=0;i<n;i++){

if(s[i]=='1' ){
 s[i]='x';
 if(i!=0) s[i-1]='x';
 if(i!=n-1) s[i+1]='x';

}
}
int cnt =0;
for(int i=0;i<n;i++){
if(s[i]==‘0’){
cnt++;
}
}
cout<<cnt<<endl;
}

}

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

Edit:

Meh - decipherable enough, I guess: fails on same testcase as this guy.