Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- ifstream cin("test.in");
- // ofstream cout("test.out");
- int n,m,a[101],lung=1,lmax=0,pozST,pozDR;
- cin>>n;
- for (int i=1; i<=n; i++)
- {
- cin>>a[i];
- }
- for (int i=1; i<=n-1; i++)
- {
- if (a[i]%2==0 && a[i+1]%2==0)
- {
- lung++;
- }
- else
- {
- lung=1;
- }
- if (lung>=lmax)
- {
- lmax=lung;///lung = pozDR - pozST +1
- pozDR = i+1;
- pozST = pozDR - lung +1;
- }
- }
- cout<<lmax<<" "<<pozST<<" "<<pozDR;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement