CodeForces B. Karen and Coffee
来源:互联网 发布:微博域名修改 编辑:程序博客网 时间:2024/06/06 12:43
#include<iostream>#include<math.h> #include<stdlib.h>#include<string.h> int num[200005];using namespace std;int main(){ int n, k, q; while (cin>>n>>k>>q) { int l, r; memset(num, 0, sizeof(num)); for (int i = 0; i<n; i++) { cin >> l >> r; num[l]++; num[r + 1]--; } memset(c, 0, sizeof(c)); for (int i = 1; i <= 200000; i++) { num[i] += num[i - 1]; c[i] += c[i - 1] + (num[i] >= k); } for (int i = 0; i<q; i++) { cin >> r >> l; cout << c[l] - c[r - 1] << endl; } } return 0;}
阅读全文
0 0
- CodeForces B. Karen and Coffee
- Karen and Coffee codeforces 816B
- Codeforces 816 -B. Karen and Coffee
- Codeforces 816B-Karen and Coffee
- Codeforces 816B Karen and Coffee
- Karen and Coffee codeforces
- Codeforces#419 Karen and Coffee
- Karen and Coffee 816B
- Codeforces 816B Karen and Coffee(前缀和)
- Codeforces Round #419 (Div. 2) B. Karen and Coffee
- codeforces 816-B. Karen and Coffee(前缀和+思维)
- CodeForce Round #479 B. Karen and Coffee
- Codeforces Round #419 (Div. 2) B. Karen and Coffee 预处理+技巧
- [前缀和] Codeforces Round #419 (Div. 2)B. Karen and Coffee
- CodeForces #419 Div.2 B Karen and Coffee 差分 巧妙
- Codeforces Round #419 (Div. 2) B. Karen and Coffee (差分标记)
- Codeforces Round #419 (Div. 2) B. Karen and Coffee【前缀和求区间覆盖次数】
- CF816B-Karen and Coffee
- python os.path 骚操作
- What is a NullPointerException?
- x的n次幂
- 猜数游戏
- E
- CodeForces B. Karen and Coffee
- 操作EEPROM时触发ECC内部故障导致通信失败
- codeforces731F (思维)
- 循环结构
- (转)为了快 0.00007 秒,有家交易公司花 1400 万美元买了块地
- 用Java代码实现改变一个文本中的内容,即将一个文本里的内容修改内容,并存储到另一个文本中
- 编程练习——顺时针打印矩阵
- 【CSS 基础】01 概述
- [注释转化]C语言注释转换为C++语言注释