"Portal: 51nod-1201" Brief test Instructions:
Give an integer n, divide n into several different integers, and ask how many different ways to divide
The following:
Dp
Set F[i][j] means that the number of I consisting of J, because n<=50000, and divided by the number of different, so at most can be divided into 320 (also smaller) number of the and, so I Max is 320
Transfer =f[i][j-i]+f[i-1][j-i]
The former indicates that the number of J divided into I does not include 1 of the scheme count (because the j-i equivalent to the number of I are 1, naturally the first can not have 1)
The latter indicates that the number of I included in the J is 1 (since there are 1, so 1 becomes the number of i-1)
This transfer card for a while, has a la carte.
Reference Code:
#include <cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<cmath>using namespaceStd;typedefLong LongLL;intf[410][51000],mod=1e9+7;intMain () {intN; scanf ("%d",&N); Memset (F,0,sizeof(f)); f[0][0]=1; for(intI=1; i<= the; i++) { for(intj=i;j<=n;j++) {F[i][j]= (LL) f[i-1][j-i]+ (LL) f[i][j-i])%Mod; } } intans=0; for(intI=1; i<= the; i++) ans= (LL) ans+ (LL) f[i][n])%Mod; printf ("%d\n", ans); return 0;}
51nod-1201: integer Division