[algogeeks] The Clocks - IOI 94 - 1166 of poj.org

2012-04-20 Thread Blackwizard
I have a problem with 1166 of poj.org... write a program that passed the testcases of this problem...but it's time limit exceeded... please suggest me a solution to solve this... thanks... Here is my code: #include iostream #include cmath #include vector #include string using namespace std;

[algogeeks] Re: determine if a string if of form pZq

2012-04-20 Thread vikas
couldn't understand the question :( On Apr 19, 1:32 pm, tech coder techcoderonw...@gmail.com wrote: determine whether the given string is of form pZq. p and q can contain only X and Y. like if p=XXYX then z will be XYXX for ex  XXYXXXYXX   is valid the limitation is that you can read only

[algogeeks] Re: determine if a string if of form pZq

2012-04-20 Thread Ramindar Singh
Hi While you read the string you just need to keep track of the series the count and in end do the analysis. for eg p = XXXYY Z = X q = YYXXX so the actual string would be XXXYYXYYXXX keep track of it as : 3X 2Y 1X 2Y 3X from this you can do the analysis that p would be 3X 2Y ie XXXYY and

[algogeeks] Re: determine if a string if of form pZq

2012-04-20 Thread Varun
what's q then? can you please give few more examples? On Thursday, 19 April 2012 23:02:31 UTC+5:30, tech coder wrote: determine whether the given string is of form pZq. p and q can contain only X and Y. like if p=XXYX then z will be XYXX for ex XXYXXXYXX is valid the limitation is that

[algogeeks] how to approach this kinda problmls

2012-04-20 Thread amrit harry
http://www.codechef.com/APRIL12/problems/PDSNUM -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/6NhjBLnaw0AJ. To post to this group, send email to

Re: [algogeeks] how to approach this kinda problmls

2012-04-20 Thread Vandana Bachani
hi Amrit, First you should try to write a module (function) which identifies if a number is a PDS number, basically given a number it checks whether the product of its digits is divisible by the sum of its digits. Then you should start an infinite loop and keep counting the PDS number u encounter

Re: [algogeeks] how to approach this kinda problmls

2012-04-20 Thread Vandana Bachani
A bunch of optimizations are possible like caching via hashing PDS numbers as u find for prior inputs so that some of those can be used for next inputs, etc. But first try to develop a simple algorithm. -Vandana On Fri, Apr 20, 2012 at 2:48 PM, Vandana Bachani vandana@gmail.comwrote: hi

[algogeeks] Re: how to approach this kinda problmls

2012-04-20 Thread Ramindar Singh
Just to add to Vandana certain observations like 1) consider 1,2,3,4. 9 as 01,02,03,04.. 09 so the reverse of the strings are also present in the answer ie 10,20,30,40 90 2) when you traverse the numbers like 11,12,13,14 19 and you dont find any PDS number you are omitting