Você está na página 1de 3

#include <iostream>

using namespace std;

int main()

int n;

cin >> n;

while (n != 0)

int maior, aux, soma;

maior = -1;
soma = 0;

for (int i = 0; i < n; i++)

scanf("%d", &aux);

if ((soma + aux) > 0)

soma += aux;

if (soma > maior)

maior = soma;

else

soma = 0;

}
}

if (maior > 0) { cout << "The maximum winning streak is "


<< maior << "." << endl; }

else { cout << "Losing streak." << endl; }

cin >> n;

return 0;

Você também pode gostar