#41332: 不是我的問題,絕對不是我的問題。


janray20080417@gmail.com (jan ray)


光想知道這不會有負數。

#include<bits/stdc++.h>
 
using namespace std;
int main() {
    int n,counter,max;
    int bluid[n];
    for(int i; i < n; i++) {
    cin>>bluid[i];
}
for(int i=1; i < n-1; i++) {
    if(bluid[i-1]>bluid[i]){
        counter++;
    }
    else{
    if(counter>max) {
        max = counter;
    }
    counter = 0;
    }
}
 if(counter>max) {
        max = counter;
    }
    cout<<max<<endl;
    return 0;

 
}
#41334: Re: 不是我的問題,絕對不是我的問題。


cges30901 (cges30901)


光想知道這不會有負數。

#include
 
using namespace std;
int main() {
    int n,counter,max;
    int bluid[n];
    for(int i; i < n; i++) {
    cin>>bluid[i];
}
for(int i=1; i < n-1; i++) {
    if(bluid[i-1]>bluid[i]){
        counter++;
    }
    else{
    if(counter>max) {
        max = counter;
    }
    counter = 0;
    }
}
 if(counter>max) {
        max = counter;
    }
    cout<
    return 0;

 
}


你沒輸入n啊

 

 

#41347: Re: 不是我的問題,絕對不是我的問題。


janray20080417@gmail.com (jan ray)


 

謝了 (漫長的除錯時間到......)

(沒事,我自己來)