Afişează mesaje
|
Pagini: [1]
|
4
|
Comunitate - feedback, proiecte si distractie / Blog / Răspuns: Problem: Shoe laces
|
: Aprilie 29, 2016, 00:28:05
|
I totally agree with Tiberiu regarding the equivalence between this problem and counting the expected number of cycles in a permutation of n elements , but I have a different formula . I think that the answer is = 1 + 1/2 + 1/3 + 1/4 + ... + 1/n . As a proof, I am going to use induction . Let's note E(i) : the expected number of cycles in a permutation of degree i. E(1) = 1 Let k be given (k > 1), suppose that E(k-1) is true. Every permutation of n-1 elements can generate other n-1 permutations of n elements (each of them containing the last shoe lace in an already existing cycle) and one additional permutation where the last shoe lace forms a cycle of length 1. Only the last case increses the expected value ,so we can conclude that E(i) = E(i-1) * (n-1)/n + ( E(i-1) + 1 ) * 1/n = E(i-1) + 1/n. I hope my solution is correct and easy to understand .
|
|
|
12
|
infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 1284 Unuzero
|
: Aprilie 01, 2014, 20:23:30
|
Verificati va rog testele : - In cerinta scrie la datele de intrare ca sunt 2 linii : 1) prima linie contine un nr N 2) a doua linie contine numerele p,q - In teste este de fapt o singura linie cu numerel n,p,q Cu sursa mea de pascal , de exemplu , am trecut de la pct de 0 la 60 pct doar inlocuint readln cu read. Restul punctajului l-am obtinut ulterior prin alte optimizari. Va multumesc de intelegere
|
|
|
|