Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k;
cin>>n>>k;
string s;
cin >>s;
int count=0;
while(k--)
{
for(int i=0; i<k; i++)
{
while (!s.empty() && s.back()=='1')
{
s.pop_back();
count++;
}
}
reverse(s.begin(), s.end());
}
cout<<count<<endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1159 Binary String
- Contest
- Brain Booster #8
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-02-17 16:45:52
- Judged At
- 2025-02-17 16:45:52
- Judged By
- Score
- 0
- Total Time
- 26ms
- Peak Memory
- 532.0 KiB