题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3028
题解:列出母函数乘起来化简之后再展开,用插板法即可。
代码:
#include<cstdio> #include<cstdlib> #include<cmath> #include<cstring> #include<algorithm> #include<iostream> #include<vector> #include<map> #include<set> #include<queue> #include<string> #define inf 1000000000 #define maxn 1000+5 #define maxm 200000+5 #define eps 1e-10 #define ll long long #define pa pair<int,int> #define for0(i,n) for(int i=0;i<=(n);i++) #define for1(i,n) for(int i=1;i<=(n);i++) #define for2(i,x,y) for(int i=(x);i<=(y);i++) #define for3(i,x,y) for(int i=(x);i>=(y);i--) #define for4(i,x) for(int i=head[x],y=e[i].go;i;i=e[i].next,y=e[i].go) #define for5(n,m) for(int i=1;i<=n;i++)for(int j=1;j<=m;j++) #define mod 10007 #define lch k<<1,l,mid #define rch k<<1|1,mid+1,r using namespace std; inline int read() { int x=,f=;char ch=getchar(); while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();} while(ch>=''&&ch<=''){x=*x+ch-'';ch=getchar();} return x*f; }
int n,m;
char s[maxn]; int main() { freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); scanf("%s",s);n=strlen(s);
for0(i,n-)m=(m*+s[i]-'')%mod;
cout<<m*(m+)%mod*(m+)%mod*%mod<<endl; return ; }