We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #155: Counting Capacitor Circuits.
Project Euler #155: Counting Capacitor Circuits.
Sort by
recency
|
18 Discussions
|
Please Login in order to post a comment
Hi,
My code works only for the Test Case 0,1,2,3.
My output is:
D(1) = 1, D(2) = 3, D(3) = 7, D(4) = 15, D(5) = 31, D(6) = 63, D(7) = 127, D(8) = 255, D(9) = 511, D(10) = 1023, D(11) = 2047, D(12) = 4095, D(13) = 8191, D(14) = 16383, D(15) = 32767, D(16) = 65535, D(17) = 131071, D(18) = 262143
In this comment (https://www.hackerrank.com/contests/projecteuler/challenges/euler155/forum/comments/194581) says the required output is: 1, 3, 7, 15, 35, 77, 179, 429, 1039, 2525, 6235, 15463, 38513, 96231, 241519, 607339, 1529533, 3857447.
My ouput is lower, I dont have duplicate values.
What is the mistake in my code:
Here'are the times on my laptop, C++ 16 0m0.304s 17 0m0.768s 18 0m2.104s 1.83s on Hackerrank 19 0m5.868s 20 0m18.168s 21 0m53.888s
The case n=22 almost killed my 8GB laptop with a swap.
So, the problem is solvable (at least in c++) without cheating.
i think there are same difficult point in this problem 1) how to exclude the duplicate value 2) how to get the corrent arrangement of full n capacitors 3) how to speed up(cut some useless branch)
i have fixed the 1 and 2, but 3 is still a difficult Challenge
i have noticed that some of possible unique configurations of the capacitor mesh result in duplicate capacitor values.
i used the property that nC0 + nC1 +......+ nCn = 2^n - 1 but I only got 4 test cases passed. please help.