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.
For those who are stuck. The first thing to do is to find all abc hits for c < 100000 and r = 1.5. There are exactly 83519 triplets. For every triplet calculate the t for which rad(abc) = c^t. Build segment tree from all triplets with cumulative sums. Then use the tree to find the sum for all queries.
tree build: 150 ms
100000 queries: 150 ms
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #127: abc-hits
You are viewing a single comment's thread. Return to all comments →
For those who are stuck. The first thing to do is to find all abc hits for c < 100000 and r = 1.5. There are exactly 83519 triplets. For every triplet calculate the t for which rad(abc) = c^t. Build segment tree from all triplets with cumulative sums. Then use the tree to find the sum for all queries.