社区讨论
RE?
P1840Color the Axis参与者 3已保存回复 2
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 2 条
- 当前快照
- 1 份
- 快照标识符
- @mlrqdzyx
- 此快照首次捕获于
- 2026/02/18 15:49 20 小时前
- 此快照最后确认于
- 2026/02/19 12:12 1 分钟前
CPP
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<string.h>
#include<vector>
using namespace std;
bool h[20005];
int main()
{
memset(h, true, sizeof(h));
int n, m, cent=0;
cin >> n >> m;
for (int i = 1; i <= m; i++)
{
int l, r;
cin >> l >> r;
for (int j = l; j <= r; j++)
{
if (h[j])
{
h[j] = false;
cent++;
}
}
cout << n - cent << endl;
}
return 0;
}
回复
共 2 条回复,欢迎继续交流。
正在加载回复...