@anubhav.. Its 2n C n...
Basically they are asking u to finds no. of paths that can be formed using m Tops and m rights..which is nothing but no. of unique ways of arranging m T's and m R's .. i,e 2n C n On Dec 16, 5:38 pm, sourabh singh <singhsourab...@gmail.com> wrote: > limit is just v.smll can ny1 help me with this code: [ c code ] get it > under 120 bytes . > is there any way to take inputs. without using scanf ??? in c . m > thinking about inputs getting into > argc array directly.??? > > #define s(n) scanf("%d",&n); > f(int n){return n==1?1:(n*f(n-1));} > main() > { > int t,n; > s(t) > while(t--) > { s(n) > printf("%d",(f(2*n)/f(n))/f(n)); > } > > > > > > > > } > On Thu, Dec 15, 2011 at 10:08 PM, anubhav raj <anubhaw....@gmail.com> wrote: > > #include<stdio.h> > > #define s(n) scanf("%d",&n) > > #define I int > > I a[14][14]; > > I d(I m,I n) > > { > > I s=a[m][n]; > > I k; > > if(!m||!n) > > k=1; > > else if(s) > > k=s; > > else > > { > > k=d(m-1,n)+d(m,n-1); > > s=k; > > } > > return k; > > } > > main() > > { > > I t,n,k;s(t); > > while(t--) > > { > > s(n); > > k=d(n,n); > > printf("%d\n",k); > > } > > } > > > @saurav:this is the actual and very simple code...........may be u cn > > reduce its no of bytes........its simple dp approach...tnx.... > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.