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%[email protected]>
>> <algogeeks%[email protected]<algogeeks%[email protected]>
>> >
>> > > .
>> > > 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%[email protected]>
>> .
>> 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%[email protected]>
> .
> 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].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to