【CSP】201809-2 买菜
作者:互联网
#include <iostream>
#include <cstdio>
using namespace std;
int t[1000010];
int n, x, y, mx = 0, cnt = 0;
int main(){
cin >> n;
for (int _ = 0; _ < 2*n; _++){
cin >> x >> y;
if (y > mx) mx = y;
for (int i = x; i < y; i++) t[i] += 1;
}
for (int i = 1; i <= mx; i++) if (t[i] == 2) cnt++;
cout << cnt;
return 0;
}
标签:std,1000010,int,cin,买菜,mx,201809,include,CSP 来源: https://blog.csdn.net/weixin_43359312/article/details/115416113