The maximum limit should be increased. Brute force solution in Java does not time out at 100000, but does time out at 1000000. I suggest to set the limit even higher, to 10000000 or something.
Go java. To see a brute force solution that doesn't time out, please visit my solution.
To be fair, sd23152243 brute forced it first successfully according to the solution history in java at least.
I use Python3..
The last case always timeout.. The greatest value of N that runs for me is 12760
N>=12761 → Timeout..
Is this an optimisation work or the IDE will not support more than that
This means your algo is not optimal. You need to find a better algorithm.
Your algorithm is too slow.
Find another one.
I've used brute force in C (but no factorization) and doesn't timeout until the maximum result representable as a int64 (wich is for n = 100889). However it does time out for n = 117739.
I confess I wasn't able to disvover the trick . I'm going to check other's solutions.
Increase the limit. You can easily brute force by checking only upto sqrt of a number to find all factors.
Hello guys. I was working on this puzzle today. I thought I found a good solution, giving me the sum in a quick time, but when it get to the last test, I get “-1927827902” as a result. No “timeout error”. Any idea why?
Python code worked fine but this time it’s in C# and this error occurs.
Because your int is not long enough in C#.
Damn, it was as simple as using long instead of int…I feel so dumb ! Thanks nicola1 !