标签:style blog class code tar c
#include <stdio.h> #include <string.h> const int N = 505; int n; long long ans[N * 2], dp[N][5][2]; void DP() { for (int k = 0; k < 2; k++) { dp[1][0][k] = 1; for (int i = 2; i < N; i++) { for (int j = 0; j < 5; j++) { dp[i][j][k] = dp[i - 1][j][k]; if (j > 0) dp[i][j][k] += dp[i - 1][j - 1][k]; } } } } void init() { DP(); for (int i = 1; i <= 1000; i++) { int n = (i + 4) / 2; if (i % 2 || i < 4) ans[i] = 0; else ans[i] = dp[n][3][0] + dp[n][4][1] + dp[n][4][0]; } } int main() { init(); int cas = 0; while (~scanf("%d", &n) && n) { printf("Case %d: %lld\n", ++cas, ans[n]); } return 0; }
UVA 1073 - Glenbow Museum(数论+计数问题+递推),布布扣,bubuko.com
UVA 1073 - Glenbow Museum(数论+计数问题+递推)
标签:style blog class code tar c
原文地址:http://blog.csdn.net/accelerator_/article/details/25473649