| 2 | using namespace std; |
| 3 | |
| 4 | int maxones(bool a[],int n){ |
| 5 | int res=0,cur=0; |
| 6 | for(int i=0;i<n;i++){ |
| 7 | if(a[i]==0){ |
| 8 | cur=0; |
| 9 | } |
| 10 | else{ |
| 11 | cur++; |
| 12 | res=max(res,cur); |
| 13 | } |
| 14 | } |
| 15 | return res; |
| 16 | } |
| 17 | |
| 18 | int main(){ |
| 19 | bool a[]={1,1,1,0,1,1,1,0,1,0,1,0,1,1}; |