// UVa 10684 - The jackpot
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n) {
signed long long int streak = 0, sol = 0;
for (int i = 0; i < n; i++) {
int v;
cin >> v;
streak += v;
if (streak < 0)
streak = 0;
if (streak > sol)
sol = streak;
}
if (sol > 0)
cout << "The maximum winning streak is " << sol << "." << endl;
else
cout << "Losing streak." << endl;
cin >> n;
}
return 0;
}
Showing posts with label UVa 10684 - The jackpot. Show all posts
Showing posts with label UVa 10684 - The jackpot. Show all posts
Tuesday, September 8, 2015
UVa 10684 - The jackpot
Subscribe to:
Posts (Atom)