生成函数初步
发表于|更新于
|字数总计:664|阅读时长:3分钟|阅读量:
在车人的要求下,玉帛拿一下午讲了生成函数
这个大坑不知道要填多久
前置知识:求导(真够让人头大)
这是讲解:懒得写了,全英文但勉强能看
好了看例题:
如果看了上面的资料,那这就十分板了呀
f1=1−x21f2=1+xf3=1+x+x2f4=1−x2xf5=1−x41f6=1+x+x2+x3f7=1+xf8=1−x31<a1,a2,a3…an>⟷1−x21(1+x)(1+x+x2)1−x2x1−x41(1+x+x2+x3)(1+x)1−x31=(1+x)(1−x)1(1+x)(1+x+x2)(1+x)(1−x)x(1+x2)(1+x)(1−x)x(1+x2)(1+x)(1+x)(1−x)(1+x+x2)1=(1−x)4x=x(1−x)−4=xk≥0∑(k−4)(−x)kai=(i−1−4)(−1)i−1=(i−1i+2)=(3i+2)=6i(i−1)(i−2)
注意处理输入,需要逐位读入。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#include <bits/stdc++.h> #define int long long #define fish signed using namespace std; const int INF = 0x3f3f3f3f3f3f3f3f, mod = 1e4 + 7; int n; int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-') f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=((x<<1)%mod+(x<<3)%mod+(ch^48)%mod)%mod; ch=getchar(); } return (f*x%mod+mod)%mod; } fish main() { n=read(); cout << (n * (n + 1) % mod * (n + 2) % mod * 1668 % mod) % mod; return 0; }
|