Does anyone have any interesting test cases for this problem? I am missing a corner case and I am unable to find the reason.My program handles long values.
Thanks in advance.
Did you find something and are you willing to share it? =)(I'm in the same situation...)
Use Big Integers for the results. I have been using long values which were not enough for the computations.
Cheers, that solved the problem I was having as well
BigInteger did the trick =)
Hi guys, can anyone give me a hint? The only solution I came up with is to compute all possible combinations of which friends show up and then do LCM of all combinations, which sounds stupid as the number of combinations can be quite big.
This worked for me. Be sure to use lcm(a,b,c) = lcm(a,lcm(b,c))
Same as the above, but it's unsigned long long in C++ to be long enough; I was getting errors until I made sure that was possible in my code.