Advertisement
Saleh127

CF 846A

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