校门外的树

所属分类:Windows编程
开发工具:C/C++
文件大小:1KB
下载次数:0
上传日期:2018-06-12 06:16:59
上 传 者sqs
说明:  某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是 11 1 米。我们可以把马路看成一个数轴,马路的一端在数轴 00 0 的位置,另一端在 LL L 的位置;数轴上的每个整数点,即 0,1,2,…,L0,1,2,…,L 0,1,2,…,L ,都种有一棵树。 由于马路上有一些区域要用来建地铁。这些区域用它们在数轴上的起始点和终止点表示。已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端点处的两棵树)移走。你的任务是计算将这些树都移走后,马路上还有多少棵树。
(There is a row of trees on the road outside the gate of the school with a length of L, and the spacing between every two adjacent trees is Eleven 1 meters. We can see the road as a number axis, and one end of the road is on the number axis. 00 0, the other end is in LL The location of L; every integer point on a number of axes, that is, 0,1,2,... L0,1,2,... L 0,1,2,... L, there is a tree. There are some areas on the road to build the subway. These regions are represented by their starting points and ending points on the number axis. The coordinates of the starting point and the ending point of any region are known to be integers. There may be overlapping parts between the regions. Now we need to remove trees from these areas, including two trees at the end of the region. Your task is to calculate how many trees there are on the road after removing all these trees.)

文件列表:
校门外的树.cpp (547, 2018-06-12)
题目.txt (1122, 2018-06-12)

近期下载者

相关文件


收藏者