Advertisement
ShafiulAzim

codeforces 1303A

Feb 24th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,i,j,c,mx;
  6. freopen("in.txt","r",stdin);
  7. freopen("out.txt","w",stdout);
  8. string str;
  9. vector<string>v;
  10. cin>>t;
  11. while(t--)
  12. {
  13. c=0;
  14. cin>>str;
  15. for(i=0; i<str.size(); i++)
  16. {
  17. if(str[i]=='1')
  18. {
  19. if(str[i+1]=='0')
  20. {
  21. for(j=i+1; j<str.size(); j++)
  22. {
  23. if(str[j]=='1')
  24. {
  25. c+=(j-i-1);
  26. break;
  27. }
  28. }
  29. }
  30. }
  31. }
  32. cout<<c<<endl;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement