#20713: 為甚麼編譯錯誤呀~


twm0970420996@gmail.com (小胖胖胖)

學校 : 不指定學校
編號 : 94884
來源 : [122.116.200.57]
最後登入時間 :
2020-07-13 23:16:38
a540. 10684 - The jackpot -- UVa10684 | From: [61.223.224.115] | 發表日期 : 2020-02-24 12:12

#include <iostream>

using namespace std;

int main(){
int N = 0 ;
while(cin >> N){
if(N > 10000 || N == 0)
return 0 ;

int A[N] = {};
int sum = 0;
int maximum = 0;

for(int i = 0 ; i < N ; i++){
sum += A[i];
if(sum < 0)
sum = 0;
if(sum >= maximum)
maximum = sum ;
}
if(maximum == 0){
cout << "Losing streak.";
}else{
cout << "The maximum winning streak is " << maximum << "." << endl;
}
}
}

 
ZeroJudge Forum