问题描述
1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int a[2000], b[2000], c[2000], d[2000]; 6 int n, t = 0, count = 0; 7 cin >> n; 8 for (int i = 0; i < n; i++) 9 cin >> a[i] >> b[i]; 10 for (int i = 0; i < n; i++) 11 cin >> c[i] >> d[i]; 12 int i = 0, j = 0; 13 while (i < n && j <n) { 14 count++; 15 if (count > a[i] && count <= b[i]) { 16 if (count > c[j] && count <= d[j]) { 17 t++; 18 } 19 20 } 21 if (count == b[i])i++; 22 if (count == d[j])j++; 23 } 24 cout << t; 25 return 0; 26 }
原文:https://www.cnblogs.com/cqy1245053939/p/10137115.html