//get n;
if(n%3==0)
{
v=6;
pw=(n-3)/3;
}
else if(n%3==1)
{
v=4;
pw=(n-1)/3;
]
else
{
v=5;
pw=(n-2)/3;
}
maxtimes=(v)*pow(2,pw);
sequence is pressing 'A' v times followed by (select+copy+paste=3
operations) pw times which means 3*pw;total 3*pw+v=n times 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]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
