Computer Science Canada HELP with SPOJ problem |
Author: | mseo [ Thu May 20, 2010 4:02 pm ] |
Post subject: | HELP with SPOJ problem |
I've started solving spoj problems recently. I've been attempting to solve ANARC09B, but kept getting wrong answer. The problem is basically asking you to find the least number of tiles needed to make a square tile with smallest side length, given an infinite supply of rectangular tiles with width W and length L. Here is link to the actual problem. https://www.spoj.pl/problems/ANARC09B/ Well... my logic was that the LCM of the two sides W and H would be the shortest possible length of the side of the square tile. Obviously, my approach is wrong . However, I just cant seem to think of a test case that will disprove my approach... Can someone please give me a testcase that will counter my logic? Thank you. P.S. I couldn't post this on the SPOJ forum... it said my ip address had been banned. |
Author: | Prabhakar Ragde [ Thu May 20, 2010 4:22 pm ] |
Post subject: | RE:HELP with SPOJ problem |
Your logic is correct. Your program may not be computing the quantity asked for, which is not "the shortest possible length of the side of the square tile". |
Author: | mseo [ Thu May 20, 2010 4:33 pm ] |
Post subject: | Re: HELP with SPOJ problem |
Wow... You are right... Thank you very much! (Instead of using long long int, I used int, so it gave me wrong answer... lol) |