mercredi 9 octobre 2019

I got a RunTime error SIGCONT for the below code

#include<iostream>
using namespace std;
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,ctr=0;
        cin>>n;
        int a[n],ptr=750;
        for(int i=0;i<n;i++){
            cin>>a[i];
            if(a[i]<ptr){
                ctr++;
                ptr=a[i];
            }
        }
        cout<<ctr-(n/5)+1<<"\n";
    }
    return 0;
}

All other answers say I would have divided by zero or accessed out of bounds but here I do not find any such situation

Aucun commentaire:

Enregistrer un commentaire