CF714A Meeting of Old Friends

https://www.luogu.org/problemnew/show/CF714A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include<bits/stdc++.h>
using namespace std;

long long l1,r1,l2,r2,k;

int main(void)
{
cin >> l1 >> r1 >> l2 >> r2 >> k;

bool TNT = 0;
long long minn = min(r1,r2);
long long maxn = max(l1,l2);

long long ans = minn - maxn + 1;

if(maxn > minn)
{
cout << 0 << endl;
TNT = 1;
}
else if(k >= maxn && k <= minn)
ans -= 1;

if(!TNT)
cout << ans << endl;

return 0;
}
本站文章除注明转载外均为原创,未经允许不要转载哇. ヾ(゚ー゚ヾ) http://chicago01.top/2019/05/11/cf714a-meeting-of-old-friends/index.html
Compartir