https://arena.moi/problem/moi21qualnones this is my code #include
include
using namespace std;
int main() { int t; cin>>t; while(t--){ string n; long long a; cin>>n>>a; long long o=0,s=0; for(char i : n){ if(i=='1') s++; if(s==a){ o++; s=0; } } cout<<o<<endl; } return 0; } i am struggling in finding the issue
Seems like you forgot to reset
s
when you encounter a'0'
.Also next time please format your code like this so it's readable:
~~~~~
Your code here...
~~~~~