zoukankan      html  css  js  c++  java
  • HDU_1284 钱币兑换问题(生成函数)

      先打表,否则TLE

    My Code:

    #include <iostream>
    #include <cstring>
    #include <cstdio>

    using namespace std;

    const int N = 32767;

    int c1[N+1], c2[N+1];

    int main() {
    //freopen("data.in", "r", stdin);

    int n, i, j, k;

    for(i = 0; i <= N; i++) {
    c1[i] = 1; c2[i] = 0;
    }
    for(i = 2; i <= 3; i++) {
    for(j = 0; j <= N; j++) {
    for(k = 0; k + j <= N; k += i)
    c2[k+j] += c1[j];
    }
    for(j = 0; j <= N; j++) {
    c1[j] = c2[j]; c2[j] = 0;
    }
    }

    while(~scanf("%d", &n)) {
    cout << c1[n] << endl;
    }
    return 0;
    }



  • 相关阅读:
    shader变体
    正向渲染
    LWPR
    blend
    slua
    unity
    jsBridge
    浏览器
    数据运营系统
    广告
  • 原文地址:https://www.cnblogs.com/vongang/p/2264537.html
Copyright © 2011-2022 走看看