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 #135: Same differences
Project Euler #135: Same differences
Sort by
recency
|
11 Discussions
|
Please Login in order to post a comment
Here's my C++ solution:
100/- Points C++
For last 5 test case, common method,to iterate from 1 to sqrt(n) to fetch all divisors, would fail with time out. Thus, we need an efficient way to find all divisors. Here's my method, hope this helps.
Very easy mathematical solution: check the delta on two variable equations. There are solutions where delta is positive or zero, and there are integer solutions where delta is a perfect square of an integer. then simply calculate the solutions and be careful not to count the same solution twice by mistake. Unfortunately I am getting timeout at the last 5 tests even tho this is the fastest I have tried :/