%%%
by xlc01 @ 2021-01-28 14:17:37
%%%
by iamzq @ 2021-01-28 14:18:28
%%%
by hbhbcc @ 2021-01-28 14:19:18
%%%
by whc2020 @ 2021-01-28 14:20:07
%%%
by Mr_H2T @ 2021-01-28 14:22:16
```
#include<bits/stdc++.h>
using namespace std;
long long n,m,f[10010][110],ans=1,b[110],maxn=0,tot;
int main(){
scanf("%d%d",&n,&m);
f[0][0]=1;
for (int j=1;j<=m;j++) {
scanf("%d",&b[j]);
maxn=maxn>b[j]? maxn:b[j];
}
for (int i=1;i<=n;i++)
for (int j=0;j<=maxn;j++){
if(j>i)continue;
f[i][j]=(f[i-1][j]+f[i-1][j-1])%10007;
}
for(int j=1;j<=m;j++){
ans=(ans*f[n][b[j]])%10007;
n-=b[j];
if(n<0){
printf("0\n");
return 0;
}
}
ans%=10007;
printf("%lld\n",ans);
return 0;
}
```
by hbhbcc @ 2021-01-28 15:46:00
1.初始化出了些问题,应该是f[i][1]=i 或者f[0][0]=1(话说我用f[i][1]=i打了90,不知是什么BUG)
2.把第9行m改成100(所有数据中ai的最大值)或者maxn(输入数据中ai的最大值)
3.必要的话加一个数据越界特判(第19行),防止出现奇怪的问题(不加好像也没事)
by hbhbcc @ 2021-01-28 15:51:03
**写f[i][1]=1的话**,由于ai可以等于0,会出问题,应该加上特判
by hbhbcc @ 2021-01-28 15:59:34
~~大骂ballball代码的胡笔居然在这里如此礼貌~~
by xlc01 @ 2021-01-30 07:37:00
```cpp
#include <cstdio>
using namespace std;
int total,now,num,ans=1;
int times(int num)
{
return (num==1||num==0)?1:num*times(num-1);
}
int compound(int a,int b)
{
if(a==b) return 1;
if(a==1) return b;
if(2*a>b) return compound(b-a,b);
return times(a)/(times(a-b)*times(b));
}
int main()
{
scanf("%d %d",&total,&num);
for(int i=0;i<num;++i)
{
scanf("%d",&now);
ans*=compound(now,total);
total-=now;
ans%=10007;
}
printf("%d",ans);
return 0;
}
```
为什么元帅的开O2 TLE,不开O2MLE???\
懵了
by James213 @ 2021-01-31 14:43:59