Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 HELP with SPOJ problem
Index -> Contests
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mseo




PostPosted: 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 Sad.

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.
Sponsor
Sponsor
Sponsor
sponsor
Prabhakar Ragde




PostPosted: 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".
mseo




PostPosted: 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)
Display posts from previous:   
   Index -> Contests
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: