母函数问题,今天闲来无事学习了下。
在这里多项式的写法和砝码例子的写法不一样
如果有2个a,则要写成1+x^1+x^2;
如果有2个c,则要写成1+x^3+x^6+x^9;
理解了母函数,那么就没有什么困难了
#include
#include
using namespace std;
int z[30],a[55],b[55];
int main()
{
int t;
cin>>t...
分类:
其他好文 时间:
2015-06-27 21:29:23
阅读次数:
132
JavaScript API里这样解释:A callback is a function that is passed as an argument to another function and is executed after its parent function has completed. (回调是一个函数作为参数传递给另一个函数,其母函数完成后执行。)
使用回调函数的原因:可以把调...
分类:
编程语言 时间:
2015-06-18 11:39:01
阅读次数:
140
所谓的母函数我觉得就是将一些组合数问题转化成多个多项式相乘,然后对系数做一些处理....关于母函数的题有HDU 1171,1398,1709,2065,2069,2082,2152;POJ 3046,3716,37341.hdu 1171题目大意给出一个n,接下来n行每行有v, m两个数表示有m个值...
分类:
其他好文 时间:
2015-06-15 18:11:36
阅读次数:
134
记录点滴。 1 /* 2 2015.6 HT 3 ACM Work10 4 5 */ 6 7 #include 8 #include 9 #include 10 using namespace std; 11 12 /* 13 Ignatius and the Pr...
分类:
其他好文 时间:
2015-06-14 12:17:59
阅读次数:
123
代码:
#include
#include
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,k;
int a[9],b[9];
scanf("%d%d",&n,&k);
for(int i=1; ...
分类:
其他好文 时间:
2015-06-06 23:33:57
阅读次数:
129
代码:#include
#include
using namespace std;
long long c1[8005],c2[8005];
int main()
{
int a[4];
a[1]=1;
a[2]=2;
a[3]=5;
int n[4];
while(scanf("%d%d%d",&n[1],&n[2],&n[3])&&(n[1]...
分类:
其他好文 时间:
2015-06-06 16:41:18
阅读次数:
163
Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值 2 #include 3 4 int le[30],n1[55],n2[55]; 5 6 ...
分类:
其他好文 时间:
2015-06-04 19:09:09
阅读次数:
110
分析:这题可以用母函数做,但可以找到简单的规律。
1、若1的个数为0,则输出1;
2、若1的个数不为0,则从1到n1+2*n2的数都能拼成;接着,只需考虑5的个数,若n1+2*n2能到4以上,则在所有5的组合中,中间4个间隔可以由n1+2*n2
填充,这时总和为S,则1到S之间的数都可以组成;
3、若n1+2*n2不能达到4,则开始达到5之前就断开了不能到5,就不用再去组合5的个数了。
...
分类:
其他好文 时间:
2015-06-04 13:52:10
阅读次数:
129
代码:
#include
using namespace std;
int main()
{
int n;
int a[18];
for(int i=1;i<=17;i++)
a[i]=i*i;
while(scanf("%d",&n)&&n)
{
long long c1[350],c2[350];
fo...
分类:
其他好文 时间:
2015-06-03 21:40:40
阅读次数:
112