Ciao a tutti, vorrei dei indizi per come far funzionare questo codice, se è completamente sbagliato potete anche scrivermelo
#include <assert.h>
#include <stdio.h>
#include <iostream>
// constraints
#define MAXN 100000
using namespace std;
// input data
int N, K, i;
int V[MAXN + 1];
int main() {
freopen("input0.txt", "r", stdin);
assert(2 == scanf("%d %d", &N, &K));
for (i = 1; i <= N; i++) assert(1 == scanf("%d", &V[i]));
// insert your code here
int failedAttempts = 0, policeHouse = 1;
for(i = 0; i < N; i++){
if(policeHouse != K){
policeHouse = V[i];
failedAttempts++;
}
}
cout << failedAttempts << endl;
return 0;
}
Grazie in anticipo per i consigli