#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,m,k;
struct Int53
{
long long a[120];
int len;
Int53(int x=0){memset(a,0,sizeof(a));len=1;a[0]=x;}
inline long long &operator[](int x){return a[x];}
Int53 operator*(int x)
{
for(int i=0;i<len;i++)a[i]*=x;
for(int i=0;i<len;i++)
{
if(a[i]>>53)a[i+1]+=a[i]>>53,a[i]&=9007199254740991;
if(a[len]&&len<=115)len++;
a[115]=0;
}return *this;
}
Int53 operator+(Int53 x)
{
Int53 res;res.len=max(len,x.len);
for(int i=0;i<res.len;i++)
{
res[i]+=a[i]+x[i];
if(res[i]>>53)res[i+1]+=res[i]>>53,res[i]&=9007199254740991;
}
if(res[len]&&res.len<=115)len++;
res[115]=0;
return res;
}
}res1,ans;
struct Int
{
int a[1200],len;
Int(int x=0){memset(a,0,sizeof(a));len=1;a[0]=x;}
inline int&operator[](int x){return a[x];}
void print(int k)
{
printf("%d",a[min(k,len)-1]);
for(int i=min(k,len)-2;i>=0;i--)printf("%d",a[i]);
printf("\n");
}
Int operator+(Int x)
{
Int res;res.len=max(len,x.len);
for(int i=0;i<res.len;i++)
{
res[i]+=x[i]+a[i];
if(res[i]>9)res[i+1]+=res[i]/10,res[i]%=10;
}while(res[res.len]&&res.len<=1005)res.len++;
res[1005]=0;
return res;
}
Int operator+(int x)
{
a[0]+=x;len=0;
while(a[len]>9)a[len+1]+=a[len]/10,a[len]%=10,len++;
while(a[len]&&len<=1005)len++;
a[1005]=0;
return *this;
}
Int mul26()
{
for(int i=0;i<len;i++)a[i]<<=26;
for(int i=0;i<len;i++)
{
if(a[i]>9)a[i+1]+=a[i]/10,a[i]%=10;
if(a[len]&&len<=1005)len++;
}a[1005]=0;
return *this;
}
Int mul()
{
for(int i=0;i<len;i++)a[i]<<=1;
for(int i=0;i<len;i++)
{
if(a[i]>9)a[i+1]+=a[i]/10,a[i]%=10;
if(a[len]&&len<=1005)len++;
}a[1005]=0;
return *this;
}
Int Pow(int a,int b)
{
Int res;res=res+b;
for(int i=0;i<a;i++)
{
res.mul26();
res.mul26();
res.mul();
}
return res;
}
Int operator=(Int53 x)
{
len--;
for(int i=0;i<x.len;i++)
{
Int T(1);
*this=*this+Pow(i,x[i]);
}
return *this;
}
}res;
int main()
{
freopen("mnk.in","r",stdin);
freopen("mnk.out","w",stdout);
scanf("%d%d%d",&m,&n,&k);
for(int i=1;i<=m;i++)
{
ans=Int53(1);
if(i!=1)for(int j=1;j<=n;j++)ans=ans*i;
res1=res1+ans;
}res=res1;res.print(k);
fclose(stdin);fclose(stdout);
return 0;
}
转载于:https://my.oschina.net/u/2608895/blog/600285