Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. //============================================================================
  2. // Name : E.cpp
  3. // Author :
  4. // Version :
  5. // Copyright : Your copyright notice
  6. // Description : Hello World in C++, Ansi-style
  7. //============================================================================
  8.  
  9. #include <iostream>
  10. using namespace std;
  11. typedef long long ll;
  12. int testCases;
  13.  
  14. ll n,k;
  15.  
  16. int main() {
  17. cin>>testCases;
  18. while(testCases--)
  19. {
  20. string temp;
  21. cin>>n>>k;
  22. cin>>temp;
  23. ll contigous=0;
  24. ll local=0;
  25. for(int i=0;i<n;++i)
  26. {
  27. if(temp[i]=='1')
  28. {
  29. local=0;
  30. contigous=max(local,contigous);
  31. }else
  32. {
  33. local++;
  34. }
  35. }
  36. if(contigous>=(k+1))
  37. {
  38. cout<<"yes"<<endl;
  39. }
  40. else
  41. {
  42. cout<<"no"<<endl;
  43. }
  44.  
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement