#include <bits/stdc++.h>usingnamespacestd;
int main()
{
int a, b, c, d, bei;
scanf("%d%d%d%d", &a, &b, &c, &d);
bei = a / __gcd(a, b) * b;
if (c % bei == 0)
cout << d / bei - c / bei + 1;
elsecout << d / bei - c / bei;
return0;
}
#include <bits/stdc++.h>#define ll long longusingnamespacestd;
constint p = 1e9 + 7;
ll f[2010], gg[2010];
int sum = 0, num = 0, a[2010], n;
int main()
{
scanf("%d", &n);
gg[0] = 1;
for (int i = 1; i <= n; ++i)
{
scanf("%d", &a[i]);
if (a[i] == -1)
sum++;
}
for (int i = 1; i <= n; ++i)
if (a[i] != -1 && a[a[i]] == -1)
num++;
for (int i = 1; i <= num; ++i)
gg[i] = gg[i - 1] * i % p;
int t = sum - num;
f[0] = gg[num];
for (int i = 1; i <= t; ++i)
{
f[i] = ((num + i - 1) * f[i - 1]) % p;
if (i > 1)
f[i] = (f[i] + (i - 1) * f[i - 2]) % p;
}
printf("%lld", f[t]);
}
T1 The Wall题意解法代码网址这一题小结T2 Maximal Area Quadrilateral题意解法代码网址这一题小结T3 Tourist Problem题意解法代码网址这一题小结T4 Bubble Sort Graph题意解法代码网址这一题小结T5 Iahub and Permutations题