第一题
一道模拟题,1分钟就想到思路了。直接在l到r这个区间内遍历一下,如果这个数和abc都不相等,cnt就++。最后输出就行了。
```#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sc scanf
#define pf printf
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef unsigned long long ull;
typedef pair<int, int> PII;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
int ddx[] = {-1, 1, 0, 0, -1, 1, -1, 1};
int ddy[] = {0, 0, -1, 1, -1, -1, 1, 1};
LL ksm(LL a, LL b, LL p)
{
LL sum = 1;
a %= p;
while (b)
{
if (b & 1) sum = (sum * a) % p;
b >>= 1;
a = (a * a) % p;
}
return sum % p;
}
bool is_prime(int x)
{
if (x == 0 || x == 1) return false;
for (int i = 2; i * i <= x; i ++)
if (x % i == 0) return false;
return true;
}
bool is_runyear(int y)
{
return (y % 400 == 0 || (y % 100 != 0 && y % 4 == 0));
}
LL gcd(LL x, LL y)
{
while (y)
{
x %= y;
swap(x, y);
}
return x;
}
const int N = 110;
/*
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 3 3 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 4 6 4 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
...
*/
int a, b, c, l, r, cnt;
void solve()
{
cin >> a >> b >> c >> l >> r;
for (int i = l; i <= r; i ++)
{
if (i != a && i != b && i != c)
{
cnt ++;
}
}
cout << cnt << endl;
}
int main()
{
IOS;
int _ = 1;
// cin >> _;
while (_ --)
{
solve();
}
return 0;
}

京公网安备 11010502036488号