#include\x20 #include\x20

using\x20namespace\x20std;

int\x20main()\x20{ \x20\x20int\x20L, M; \x20\x20cin\x20>>\x20L\x20>>\x20M; \x20\x20 \x20\x20vector\x20trees(L+1, true);\x20//\x20初始化马路上的树 \x20\x20 \x20\x20for\x20(int\x20i\x20=\x200; i\x20<\x20M; i++)\x20{ \x20\x20\x20\x20int\x20start, end; \x20\x20\x20\x20cin\x20>>\x20start\x20>>\x20end; \x20\x20\x20\x20 \x20\x20\x20\x20for\x20(int\x20j\x20=\x20start; j\x20<=\x20end; j++)\x20{ \x20\x20\x20\x20\x20\x20trees[j]\x20=\x20false; //\x20将区域内的树移走 \x20\x20\x20\x20} \x20\x20} \x20\x20 \x20\x20int\x20count\x20=\x200; \x20\x20for\x20(bool\x20tree\x20:\x20trees)\x20{ \x20\x20\x20\x20if\x20(tree)\x20{ \x20\x20\x20\x20\x20\x20count++; //\x20统计剩余的树的数量 \x20\x20\x20\x20} \x20\x20} \x20\x20 \x20\x20cout\x20<<\x20count\x20<<\x20endl; \x20\x20 \x20\x20return\x200;


原文地址: https://www.cveoy.top/t/topic/pLq8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录