https://www.cnblogs.com/imzscilovecode/p/8666783.html
#include<bits/stdc++.h>
using namespace std;
const int N = 1000010, MOD = 100000007;
typedef long long ll;
ll f[N];
ll n, s, a, b;
int main()
{
cin >> n >> s >> a >> b;
f[0] = 1;
for(int i = 1; i < n; i ++)
for(int j = (i + 1) * i / 2; j >= i; j --)
f[j] = (f[j - i] + f[j]) % MOD;
ll tot = n * (n - 1) / 2, sum = 0;
for(int i = 0; i <= tot; i ++)
//if((i * a - (tot - i) * b) % n == s % n)
if((s - i * a + (tot - i) * b) % n == 0)
sum = (sum + f[i]) % MOD;
cout << sum;
}
typedef long long ll;和#define long long ll有啥区别呢请问
为什么会问我这个问题,百度呗,我也不知道