求大佬帮忙修改
测试全对,测评RE
#include<bits/stdc++.h>
using namespace std;
int l,s,t,n,dp[1005];
bool st[105],vis[105];
int main(){
scanf("%d%d%d%d",&l,&s,&t,&n);
for(int i=1;i<=n;i++){
int a;
scanf("%d",&a);
st[a]=true;
}
memset(dp,0x3f,sizeof dp);
dp[0]=0,vis[0]=true;
for(int i=0;i<=l;i++)
for(int j=s;j<=t;j++){
if(vis[i-j]==true)vis[i]=true;
else continue;
if(st[i]==true) dp[i]=min(dp[i],dp[i-j])+1;
else dp[i]=min(dp[i],dp[i-j]);
}
printf("%d\n",dp[l]);
return 0;
}