标签:
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int dp[10][85]; int main() { int S; memset(dp,0,sizeof(dp)); for(int i = 1; i <= 9; i++) dp[1][i] = 1; for(int i = 2; i <= 9 ;i++){ for(int j = 1; j <= 81; j++) { dp[i][j] = dp[i-1][j]; for(int k = 1; k <= 9 && k <= j ;k++){ dp[i][j] += dp[i-1][j-k]; } } } while(~scanf("%d",&S)){ int ans = 0; if(S == 1) {printf("10\n"); continue;} for(int i = 1; i <= 9;i++) ans += dp[i][S]; printf("%d\n",ans); } return 0; }
URAL1353——DP——Milliard Vasya's Function
标签:
原文地址:http://www.cnblogs.com/zero-begin/p/4484597.html