好久没有更新博客了话说…
博主并没有退役….
我们写出每种食物的生成函数
承德汉堡:
1+x2+x4....=11−x2
可乐:
1+x
鸡腿:
1+x+x2=1−x31−x
蜜桃多:
x+x3+x5....=x1−x2
鸡块:
1+x4+x8....=11−x4
包子:
1+x+x2+x3=1−x41−x
土豆片炒肉:
1+x
面包:
1+x3+x6....=11−x3
乘一起,约分后得
x(1−x)4
展开后第n项的系数就是
C3n+2
,于是套个Lucas就可以了
code:
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<vector>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 1e15
using namespace std;
const int Mod = 10007;
const int maxn = 1100;
int n;
char str[maxn];
int c[Mod+1][4];
int main()
{
c[0][0]=1ll;
for(int i=1;i<=Mod;i++)
{
c[i][0]=1ll;
for(int j=1;j<=3;j++) c[i][j]=(c[i-1][j-1]+c[i-1][j])%Mod;
}
scanf("%s",str); int len=strlen(str);
for(int i=0;i<len;i++) n=(n*10+str[i]-'0')%Mod;
n+=2; n%=Mod;
printf("%d\n",c[n][3]);
return 0;
}