Te piden el número de caminos. Es decir, que hagas un algoritmo que a partir de la lista de conexiones que te dan te saque el 226.
Esto siempre lo hacen, porque lo que sale ahí es un ejemplo. Si te registras te dan un input (personalizado además, es distinto para cada uno) y tienes que dar el resultado para tu input.
Yo lo he hecho esta mañana en un rato que he tenido, pero no he quedado demasiado satisfecho con mi solución. Por la noche intentaré optimizarlo un poco y lo pondré aquí.
Como siempre, dejo la segunda parte para quien no quiera registrarse o hacer la primera.
--- Part Two ---
After reviewing the available paths, you realize you might have time to visit a single small cave twice. Specifically, big caves can be visited any number of times, a single small cave can be visited at most twice, and the remaining small caves can be visited at most once. However, the caves named start and end can only be visited exactly once each: once you leave the start cave, you may not return to it, and once you reach the end cave, the path must end immediately.
Now, the 36 possible paths through the first example above are:
start,A,b,A,b,A,c,A,end start,A,b,A,b,A,end start,A,b,A,b,end start,A,b,A,c,A,b,A,end start,A,b,A,c,A,b,end start,A,b,A,c,A,c,A,end start,A,b,A,c,A,end start,A,b,A,end start,A,b,d,b,A,c,A,end start,A,b,d,b,A,end start,A,b,d,b,end start,A,b,end start,A,c,A,b,A,b,A,end start,A,c,A,b,A,b,end start,A,c,A,b,A,c,A,end start,A,c,A,b,A,end start,A,c,A,b,d,b,A,end start,A,c,A,b,d,b,end start,A,c,A,b,end start,A,c,A,c,A,b,A,end start,A,c,A,c,A,b,end start,A,c,A,c,A,end start,A,c,A,end start,A,end start,b,A,b,A,c,A,end start,b,A,b,A,end start,b,A,b,end start,b,A,c,A,b,A,end start,b,A,c,A,b,end start,b,A,c,A,c,A,end start,b,A,c,A,end start,b,A,end start,b,d,b,A,c,A,end start,b,d,b,A,end start,b,d,b,end start,b,end
The slightly larger example above now has 103 paths through it, and the even larger example now has 3509 paths through it.
Given these new rules, how many paths through this cave system are there?