11/12/2018, 18:34
12/12/2018, 16:37
12/12/2018, 21:27
bool testSequence(int n, int array[static n])
{
if (n <= 0) { return true; }
else if (array[0] != array[n-1]) {
// Nota che eliminiamo uno zero ogni volta da entrambi i lati e poi ci sono solo degli uno..
return false;
} else if (array[0] == 0) {
return testSequence(n-2, array+1);
} else if (array[0] == 1) {
return testAllOnes(n-2, array+1);
} else {
return false;
}
}
12/12/2018, 22:18
13/12/2018, 01:15
13/12/2018, 23:02
bool check(int v[],int dim){
if(dim<=2) return false; //tanto la minima stringa possibile ha lunghezza 3
13/12/2018, 23:05
13/12/2018, 23:09
13/12/2018, 23:28
13/12/2018, 23:28
bool check(int v[],int dim,int from){
if(dim<=2) return false;
if(from>=dim) return true;
else if(dim==3){
if((v[0]==0) && (v[1]==1) && (v[2]==0)) return true;
else return false;
}
else if((v[from]!=v[dim-1])&&(v[0]!=0)) return false;
else if(v[from]==0) {
return check(v+1,dim-2,from+1);
}
else if(v[from]==1) return checkone(v+1,dim-2);
else return false;
}
Skuola.net News è una testata giornalistica iscritta al Registro degli Operatori della Comunicazione.
Registrazione: n° 20792 del 23/12/2010.
©2000—
Skuola Network s.r.l. Tutti i diritti riservati. — P.I. 10404470014.
Powered by phpBB © phpBB Group - Privacy policy - Cookie privacy
phpBB Mobile / SEO by Artodia.