Skip to content

Instantly share code, notes, and snippets.

@KT-Yeh
Created March 19, 2014 15:37
Show Gist options
  • Save KT-Yeh/9644344 to your computer and use it in GitHub Desktop.
Save KT-Yeh/9644344 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
int main()
{
int N, num;
while (scanf("%d", &N) && N) {
int Max = 0;
int MSS = -1;
while (N--) {
scanf("%d", &num);
if (MSS < 0) MSS = num;
else MSS += num;
if (MSS > Max) Max = MSS;
}
if (Max > 0) printf("The maximum winning streak is %d.\n", Max);
else puts("Losing streak.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment