Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void secvMaxima2(int n, int v[], int &pi2, int &pf2, int c)
- {
- int i, j;
- int max, lung,s;
- max = 0;
- i = 0;
- pi2 = -1;
- pf2 = -1;
- while (i < n)
- {
- lung = 0;
- j = i ;
- s = 0;
- while ((j<n) && (s!=c))
- {
- s = s + v[j];
- j++;
- lung++;
- if (s==c)
- {
- if (lung > max)
- {
- max = lung;
- pi2 = i;
- pf2 = j-1;
- }
- }
- }
- i++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement