viewing paste Unknown #35772 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
            public ulong Esperance()
            {
                ulong somme = 0;
                int puissance = 0;
                //On boucle sur la taille du tableau
                for (int i =0; i< this.motif.Length; i++) {
                    puissance = i+1;
                    for (int j=0; j<=i; j++) {
                        if (motif [j] != motif [motif.Length- i+j-1]) {
                            puissance = 0;
                        }
                    }
                    if (puissance != 0) {
                        somme = somme + (ulong)(Math.Pow ((ulong)2, (ulong)puissance));
                    }
                }
 
                return somme;
            }
Viewed 890 times, submitted by Guest.