1 solutions

  • 1
    @ 2025-8-21 9:08:02
    #include<bits/stdc++.h>
    using namespace std;
    const int N=2e5+10,P=1e9+7;
    int f[N*2]; //f[i+N]表示值为i时的方案数 
    int main()
    {
    	int n,a,b,c;
    	cin>>n>>a>>b>>c;
    	f[n+N]=1;
    	for(int i=n;i>c;i--) //倒着计算方案 
    	{
    		f[N+i-a]=(f[N+i-a]+f[N+i])%P;
    		f[N+i-b]=(f[N+i-b]+f[N+i])%P;
    	}
    	int ans=0; //累加方案 
    	for(int i=0;i<=N+c;i++) //小于等于c的方案数 
    	{
    		ans=(ans+f[i])%P;
    	}
    	cout<<ans;
    	return 0;
    }
    
    
    • 1

    Information

    ID
    2171
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    # Submissions
    2
    Accepted
    2
    Uploaded By