【生成函数】Step 0 HDU 1208

BabbleDay posted @ 2013年7月24日 00:55 in 刷题防身 , 583 阅读

Ignatius and the Princess III

生成函数的最基本的模板应用,可以看作模板~

#include <iostream>
#define N 125
using namespace std;


int main()
{
    int n;
    int c1[N], c2[N];
    while(cin >> n)
    {
    for(int i=0; i<=n; i++)
    {
        c1[i] = 1;
        c2[i] = 0;
    }
    for(int i=2; i<=n; i++)
    {
        for(int j=0; j<=n; j++)
        {
            for(int k=0; k+j<=n; k+=i)
            {
                c2[k+j] += c1[j];
            }
        }
        for(int j=0; j<=n; j++)
        {
            c1[j] = c2[j];
            c2[j] = 0;
        }
    }
    cout << c1[n] << endl;
    }
    return 0;
}
Avatar_small
Maha Board 2nd Clas 说:
2023年9月20日 00:44

Maharashtra Board 2nd Class Exam Date Sheet 2024 Available at Official Website. This Maha Board Primary School Exam Attended Every Year More than 50 Laks of Students, MSCE Pune Little Students Studying Maharashtra Class Revised Syllabus 2024 helps Students to Learn Logic and order and hence,Maharashtra Elementary Syllabus 2024 is Designed in Accordance with the NCERT Based Maha Board 2nd Class Syllabus 2024 Guidelines and helps Students to get an Overview of the Marathi, English Medium All Subject, Students Should Perform well in the Exam, which is Possible by Understanding the Syllabus and Studying Accordingly.To Prepare well for the Maharashtra Class get Promoted to the next Standard, Understanding of the syllabus of Maharashtra State Board for each subject is essential


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter