80分求助
查看原帖
80分求助
786274
Ljinzhou楼主2023/4/24 20:30

Wrong Answer.wrong answer On line 1 column 1, read 3, expected 5.
第一个测试点WA

#include <iostream>

using namespace std;

int main(){
    int n;  cin >> n;
    int arr[n], result = 1, before, after;  cin >> before;
    for(int i = 0; i < n - 1; i++){
        cin >> after;
        if(before + 1 == after){
            result++;
        }else {
            result = 1;
        }
        arr[i] = result;
        before = after;
    }
    int max_result = arr[0];
    for(int i : arr){
        if(i > max_result){
            max_result = i;
        }
    }
    cout << max_result << endl;
    return 0;
}
2023/4/24 20:30
加载中...