2016-05-26 Problem Solving►ZeroJudge ZeroJudge d289 - 多元一次方程式 Contents 1. Problem2. Solution3. Code Problem題目網址 Solution似背包問題,用 DP 求出每一個數有幾組解。 CodeZJ d289ZJ d28912345678910111213141516#include<cstdio>#define N 8001int main(){ int coe[8] = { 1, 13, 33, 43, 139, 169, 1309, 2597 }; int i, j, dp[N] = {1}, n; for (i = 0; i < 8; i++) for (j = coe[i]; j < N; j++) dp[j] += dp[j - coe[i]]; while (scanf("%d", &n) != EOF) printf("%d\n", dp[n]); return 0;} Newer UVa 11942 - Lumberjack Sequencing Older ZeroJudge a567 - 死線排程