标签:hdu1799
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2821 Accepted Submission(s): 1022
2 1 3 2 3
3 3
在演草纸上列表格找规律。
#include <stdio.h> #define maxn 2002 int dp[maxn][maxn]; void count() { int i, j; for(i = 1; i < maxn; ++i) dp[i][1] = i % 1007; for(i = 1; i < maxn; ++i) for(j = 2; j < maxn; ++j) dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % 1007; } int main() { int n, m, t; count(); scanf("%d", &t); while(t--){ scanf("%d%d", &m, &n); printf("%d\n", dp[n][m]); } return 0; }
HDU1799 循环多少次?【找规律】,布布扣,bubuko.com
标签:hdu1799
原文地址:http://blog.csdn.net/chang_mu/article/details/38322929