Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 8f24c09d rédigé par Luna MANSON's avatar Luna MANSON
Parcourir les fichiers

dec 8

parent 1e8ee614
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -30,5 +30,41 @@ rapportera pas de points.
*/
func conway(n int) (un []int) {
if n == 0 {
return []int{1}
}
var tabanc []int = conway(n - 1)
for i := 0; i < len(tabanc); {
var occ, pos int = nboccu(tabanc[i:], tabanc[i])
i = pos
un = append(un, occ, tabanc[i])
}
return un
}
func nboccu(tab []int, x int) (occ, pos int) {
for pos := 0; pos < len(tab); {
if tab[pos] == x {
occ++
pos++
} else {
break
}
}
return occ, pos
}
/* func estdans(tab []int, x int) (ans bool) {
for i := 0; i < len(tab); i++ {
if x == tab[i] {
return true
}
}
return ans
} */
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter