90分,用的dp代码如下:
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e5+3;
int a,b,c,d,k;
int f[2000][2000];
int h(int i){
if(i>a){
return d;
}
return b+d;
}
int main(){
cin>>a>>b>>c>>d>>k;
int w=a+c;
f[w][0]=1;
f[w][1]=h(w);
for(int i=w;i>=1;i--){
for(int j=0;j<=k;j++){
f[i-1][j]=(f[i-1][j]+f[i][j])%mod;
f[i-1][j+1]=(f[i-1][j+1]+(h(i-1)-j)*f[i][j])%mod;
}
}
cout<<f[1][k];
}