problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
luogu::P1047类 参考

洛谷 P1047 [NOIP2005 普及组] 校门外的树 更多...

#include <luogu.h>

静态 Public 成员函数

static int main (istream &cin, ostream &cout)
 

详细描述

洛谷 P1047 [NOIP2005 普及组] 校门外的树

在文件 luogu.h389 行定义.

成员函数说明

◆ main()

int luogu::P1047::main ( istream &  cin,
ostream &  cout 
)
static

在文件 luogu.cpp1144 行定义.

1144 {
1145 int l;
1146 int m;
1147 cin >> l >> m;
1148 auto *tree = new bool[l + 1];
1149 memset(tree, 1, (l + 1) * sizeof(bool));
1150 for(int i = 0; i < m; i++) {
1151 int u;
1152 int v;
1153 cin >> u >> v;
1154 for(int j = u; j <= v; j++) {
1155 tree[j] = false;
1156 }
1157 }
1158 int ans = 0;
1159 for(int i = 0; i <= l; i++) {
1160 if(tree[i]) {
1161 ans++;
1162 }
1163 }
1164 cout << ans;
1165 delete[] tree;
1166 return 0;
1167 }

被这些函数引用 luogu::TEST().


该类的文档由以下文件生成: