Advertisement
Saleh127

cf 1433B

Oct 21st, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. test
  11. {
  12. ll a[100000],c,d,e,f,i,j=0,k=10000000,l=0;
  13. cin>>c;
  14. for(i=0;i<c;i++)
  15. {
  16. cin>>a[i];
  17. if(a[i]==1)
  18. {
  19. j=max(i,j);
  20. k=min(k,i);
  21. }
  22. }
  23. for(i=k;i<=j;i++)
  24. {
  25. if(a[i]==0)
  26. {
  27. l++;
  28. }
  29. }
  30. cout<<l<<endl;
  31. }
  32.  
  33.  
  34.  
  35. return 0;
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement