Application of hdu1398 common female function in solving multi-set combinatorial problem

Source: Internet
Author: User

The meaning of this question is to give you 1^2 2^2 3^2 ... 17^2 These 17 numbers, for you to make up the number of the scheme I, can be solved by the ordinary mother function, the coefficient represents the number of programs, (1+X+X^2+...X^300) (1+x^2+) ..., the code is as follows:

#include <iostream>#include<algorithm>using namespacestd;intnum1[ -+Ten], num2[ -+Ten];voidinit () { for(intI=0; i<= -; i++) Num1[i]=1, num2[i]=0;  for(intI=2; i<= -; i++)    {         for(intj=0; j<= -; J + +)//aj*x^j * X^k             for(intk=0; k+j<= -; k+=i*i) num2[j+k] + =Num1[j];  for(intI=0; i<= -; i++) Num1[i]=num2[i], num2[i]=0; }}intMain () {init (); intN;  while(cin>>N) {if(n==0) Break; cout<<num1[n]<<Endl; }    return 0;}

Application of hdu1398 common female function in solving multi-set combinatorial problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.