Ciao a tutti, ho bisogno di aiuto per risolvere il problema “Le mura di Bergamo.”(Training - Le mura di Bergamo).
il mio codice NON è stato fatto per il subtask 6, ma ricevo errori anche nel subtask 3 e 5 per output sbagliato
MI aiutate a capire cosa non va? grazie.
Ecco il mio codice cpp:
#include <bits/stdc++.h>
using namespace std;
int arrampicate(int N, string S){
S+='=';
N++;
int ret=0, i=0;
while(i < N){
ret++;
int att=S[i];
int j = i;
while(j < N and S[j] != '#'){
if((att == '>' and S[j] == '<') or (att == '<' and S[j] == '>')){
break;
}
att = S[j];
j++;
}
i=j+1;
}
return ret;
}
Grazie ancora!