1197: [HNOI2006] The magic of the flower Fairy

Source: Internet
Author: User

1197: [HNOI2006] Flower Fairy Magic time limit:10 Sec Memory limit:162 MB
submit:762 solved:443
[Submit] [Status] Description

Input

Contains two integers, separated by a space, the first integer represents the number of times the magic is applied M, and the second integer represents the dimension n of the space. Among them, 1≤m≤100,1≤n≤15.

Output

Contains only an integer that indicates how many different flowers the flower fairy can get after it implements M magic in n-dimensional space.

Sample Input3 1Sample Output6HINT Source

The puzzle: This is a moe DP ... Transfer: A[i,j]:=a[i,j-1]+a[i-1,j-1], the current I-dimensional j ball, so equal to the result of the former J-1 Ball + the first j-1 to introduce one-dimensional results, the other is not (Hansbug: Man's code so short x bad laugh x)

1 var2 I,j,k,l,n,m:longint;3B:Array[0.. -,0.. +] ofInt64;4 functioncal (X,y:longint): Int64;5     begin6         ifb[x,y]=1  ThenExit (A[x,y]); b[x,y]:=1;7A[x,y]:=cal (x1, Y1) +cal (x,y-1); exit (A[x,y]);8     End;9 beginTen readln (m,n); OneFillchar (b,sizeof (b),0); A      fori:=1  toN Do -         begin -A[i,1]:=2; B[i,1]:=1; the         End; -      fori:=1  toM Do -         begin -a[1, i]:=2*i;b[1, i]:=1; +         End; - Writeln (Cal (N,m)); + End.

1197: [HNOI2006] The magic of the flower Fairy

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.