it will give m=15 for n=10,but actually m=16 On Jan 21, 10:58 am, Preetam Purbia <[email protected]> wrote: > Hi, > > I think this method will work: > > Possible Number of A's = N/2(1+R) > where R=N-(N/2+3) > > assuming 11/2 = 5 > > Thanks > Preetam > > > > > > > > > > On Fri, Jan 21, 2011 at 2:29 AM, Anand <[email protected]> wrote: > > but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C > > resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20. > > > Try this on a notepad. you will only 15A's > > > On Thu, Jan 20, 2011 at 12:46 PM, Saikat Debnath > > <[email protected]>wrote: > > >> According to me Nishaanth's solution is incorrect, as let for n =10, your > >> output : m=16 > >> but my output : m =20: For first 5 times hit 'A', then ctrl+A, ctrl+C > >> resulting in 7 keystrokes. then 3 times ctrl+V, which result in m = 20. > > >> On Thu, Jan 20, 2011 at 9:24 PM, abhijith reddy d < > >> [email protected]> wrote: > > >>> I think its correct. > > >>> On Jan 19, 9:35 pm, nishaanth <[email protected]> wrote: > >>> > How about the following dynamic programming solution. > > >>> > Let dp[i] be the max no of As with i keystrokes. > > >>> > dp[i]=max(dp[i-1]+1,2*dp[i-3]) > > >>> > dp[N] is the required solution. > > >>> > Correct me if i am wrong. > > >>> > On Wed, Jan 19, 2011 at 9:20 PM, Raj <[email protected]> > >>> wrote: > >>> > >http://www.ihas1337code.com/2011/01/ctrla-ctrlc-ctrlv.html > > >>> > > On Jan 19, 8:28 pm, bittu <[email protected]> wrote: > >>> > > > Given > > >>> > > > 1. A > >>> > > > 2. Ctrl+A > >>> > > > 3. Ctrl+C > >>> > > > 4. Ctrl+V > > >>> > > > If you can only press the keyboard for N times (with the above four > >>> > > > keys), please write a program to produce maximum numbers of A. If > >>> > > > possible, please also print out the sequence of keys. > > >>> > > > So the input parameter is N (No. of keys that you can press), the > >>> > > > output is M (No. of As that you can produce). > > >>> > > > Thanks & Regards > >>> > > > Shashank Mani > > >>> > > -- > >>> > > You received this message because you are subscribed to the Google > >>> Groups > >>> > > "Algorithm Geeks" group. > >>> > > To post to this group, send email to [email protected]. > >>> > > To unsubscribe from this group, send email to > >>> > > [email protected]<algogeeks%2Bunsubscribe@googlegroups > >>> > > .com> > >>> <algogeeks%[email protected]<algogeeks%252Bunsubscribe@googleg > >>> roups.com> > > >>> > > . > >>> > > For more options, visit this group at > >>> > >http://groups.google.com/group/algogeeks?hl=en. > > >>> > -- > >>> > S.Nishaanth, > >>> > Computer Science and engineering, > >>> > IIT Madras. > > >>> -- > >>> You received this message because you are subscribed to the Google Groups > >>> "Algorithm Geeks" group. > >>> To post to this group, send email to [email protected]. > >>> To unsubscribe from this group, send email to > >>> [email protected]<algogeeks%2Bunsubscribe@googlegroups > >>> .com> > >>> . > >>> For more options, visit this group at > >>>http://groups.google.com/group/algogeeks?hl=en. > > >> -- > >> Regards > >> Saikat Kumar Debnath > >> IIIrd year, Computer Science Deptt., > >> Delhi Technological University, > >> (formerly Delhi College of Engineering) > >> Delhi > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "Algorithm Geeks" group. > >> To post to this group, send email to [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]<algogeeks%2Bunsubscribe@googlegroups > >> .com> > >> . > >> For more options, visit this group at > >>http://groups.google.com/group/algogeeks?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<algogeeks%2Bunsubscribe@googlegroups > > .com> > > . > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > Preetam Purbiahttp://twitter.com/preetam_purbia
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
