• hdu 4472动规水题


    挺水的动态规划,只要依次枚举子树的个数即可。

    /*
     * hdu4472/win.cpp
     * Created on: 2012-11-17
     * Author    : ben
     */
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <ctime>
    #include <iostream>
    #include <algorithm>
    #include <queue>
    #include <set>
    #include <map>
    #include <stack>
    #include <string>
    #include <vector>
    #include <deque>
    #include <list>
    #include <functional>
    #include <numeric>
    #include <cctype>
    using namespace std;
    const int MAXN = 1005;
    const int MOD = 1000000007;
    long long dp[MAXN];
    
    int main() {
    #ifndef ONLINE_JUDGE
        freopen("data.in", "r", stdin);
    #endif
        int t = 1, n;
        dp[1] = 1;
        for(int i = 2; i <= 1000; i++) {
            dp[i] = 0;
            for(int j = 1; j < i; j++) {
                if((i - 1) % j == 0) {
                    dp[i] += dp[(i - 1) / j];
                    dp[i] %= MOD;
                }
            }
        }
        while(scanf("%d", &n) == 1) {
            printf("Case %d: %d\n", t++, (int)dp[n]);
        }
        return 0;
    }
  • 相关阅读:
    js中Frame框架的属性获取(1)
    c#中文件上传(1)
    表单验证Validform
    Mybatis语法笔记
    js的checkbox
    调用微信Js-SDK支付
    调用微信Js-SDK图片
    java后台上传到linux
    web服务器内层溢出
    SpringMVC
  • 原文地址:https://www.cnblogs.com/moonbay/p/2775147.html
Copyright © 2020-2023  润新知