## T1 巨胖的技能组合

$$C_{n+m-1}^{n-1}$$

#include <bits/stdc++.h>
#define MOD (1000000007)
using namespace std;
typedef long long LL;
LL n,k,m,t[20],f[20][100005],ans,po[200005],ni[200005];
LL C(LL a,LL b){return po[a]*ni[b]%MOD*ni[a-b]%MOD;}
void dfs(LL cnt,LL fl,LL tot)
{
if(tot<0)return;
if(cnt==k+1)
{
ans=(ans+fl*C(tot+n-1,tot)%MOD+MOD)%MOD;
return;
}
dfs(cnt+1,fl,tot),dfs(cnt+1,-fl,tot-t[cnt]-1);
}
LL qpow(LL a,LL b)
{
LL sum=1;
while(b)
{
if(b&1)sum=sum*a%MOD;
b>>=1,a=a*a%MOD;
}
return sum;
}
int main()
{
freopen("dnf.in","r",stdin),freopen("dnf.out","w",stdout);
scanf("%lld%lld%lld",&n,&k,&m),memset(f,-1,sizeof(f)),po[1]=1,ni[1]=1;
for(int i=2;i<n+m;i++)po[i]=po[i-1]*i%MOD;
ni[n+m-1]=qpow(po[n+m-1],MOD-2);
for(int i=n+m-2;i>=2;i--)ni[i]=(i+1)*ni[i+1]%MOD;
for(int i=1;i<=k;i++)scanf("%lld",&t[i]);
dfs(1,1,m),printf("%lld\n",ans);
return 0;
}


## T2 巨胖的辗转相除

#include <bits/stdc++.h>
#define MOD (100000000)
using namespace std;
typedef unsigned char UC;
struct BI
{
int arr[2000],cnt;
BI(){cnt=0;}
void check()
{
int d=0;
for(int i=0;i<cnt;i++)arr[i]+=d,d=arr[i]/MOD,arr[i]%=MOD;
while(d)arr[cnt]=d,d=arr[cnt]/MOD,arr[cnt]%=MOD,cnt++;
}
void operator = (int a){memset(arr,0,sizeof(arr)),arr[0]=a,cnt=1,check();}
void work(BI a,BI b)
{
cnt=a.cnt;
for(int i=0;i<cnt;i++)arr[i]=a.arr[i];
for(int i=0;i<b.cnt;i++)arr[i]+=b.arr[i];
check();
}
bool operator <= (BI a)
{
if(cnt==a.cnt)
{
for(int i=cnt-1;i>=0;i--)
{
if(arr[i]<a.arr[i])return 1;
if(arr[i]>a.arr[i])return 0;
}
return 1;
}
if(cnt<a.cnt)return 1;
return 0;
}
void print()
{
printf("%d",arr[cnt-1]);
for(int i=cnt-2;i>=0;i--)printf("%.8d",arr[i]);
putchar('\n');
}
}fib[300],n;
char str[20000];
int strl;
int main()
{
freopen("euclid.in","r",stdin),freopen("euclid.out","w",stdout);
char c=getchar();
while(!isdigit(c))c=getchar();
while(isdigit(c))str[strl++]=c,c=getchar();
for(int i=strl-1;i>=0;i-=8)
{
int k=0;
for(int j=i,l=1;j>i-8&&str[j];j--,l*=10)k=k+l*(str[j]-'0');
n.arr[n.cnt++]=k;
}
fib[0]=1,fib[1]=1,fib[2]=2;UC cur=2,pre=1,post=0;
while(fib[cur]<=n){cur++,pre++,post++,fib[cur].work(fib[pre],fib[post]);}
fib[post].print(),fib[pre].print();
return 0;
}


## T3 巨胖的最大约数

（也许能证但不是很想（lande）证）

#include <bits/stdc++.h>
#define PS (25)
using namespace std;
typedef long long LL;
static const LL p[PS]=
{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
LL n,mx,ans;
void dfs(LL cur,LL cnt,LL tot)
{
if(cnt>=PS)
{
if(tot>mx||(tot==mx&&cur<ans))ans=cur,mx=tot;
return;
}
dfs(cur,cnt+1,tot);
for(LL i=p[cnt],j=2;cur*i<=n&&(cur*i)%i==0&&cur*i>0;i*=p[cnt],j++)
dfs(cur*i,cnt+1,tot*j);
}
int main()
{
freopen("divisor.in","r",stdin),freopen("divisor.out","w",stdout);
scanf("%lld",&n),dfs(1,0,1),printf("%lld\n",ans);
return 0;
}