📄 2808 -- 校门外的树.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0035)http://poj.grids.cn/problem?id=2808 -->
<HTML><HEAD><TITLE>2808 -- 校门外的树</TITLE>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="2808 -- 校门外的树.files/poj.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="2808 -- 校门外的树.files/poj.js"></SCRIPT>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY vLink=blue aLink=blue link=blue leftMargin=5><A name=top></A>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#ffffff width="100%"
border=1>
<TBODY>
<TR>
<TD
style="BACKGROUND-IMAGE: url(images/header.jpg); BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: right"
vAlign=bottom align=middle colSpan=5 height=160>
<DIV style="MARGIN-BOTTOM: 0px"><IMG src="2808 -- 校门外的树.files/logopku.gif"
border=0> <IMG src="2808 -- 校门外的树.files/logo4.gif"
border=0></DIV></TD></TR>
<TR vAlign=top align=middle bgColor=#6589d1>
<TH class=h>Online Judge</TH>
<TH class=h>Problem Set</TH>
<TH class=h>Authors</TH>
<TH class=h>Online Contests</TH>
<TH class=h>User</TH></TR>
<TR vAlign=top align=middle bgColor=#f1f1fd>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><A
href="http://poj.grids.cn/bbs">Web Board</A><BR><A
href="http://poj.grids.cn/">Home Page</A><BR><A
href="http://poj.grids.cn/faq.htm"
target=_blank>F.A.Qs</A><BR>Announcement</TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=gotoproblem method=get><A
href="http://poj.grids.cn/problemlist">Problems</A><BR><A
href="http://poj.grids.cn/submit">Submit Problem</A><BR><A
href="http://poj.grids.cn/status">Online Status</A><BR><FONT
color=blue>Prob.ID:</FONT><INPUT size=6 name=pid><INPUT type=submit value=Go name=pb1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=searchuser method=get><A
href="http://poj.grids.cn/register">Register</A><BR><A
href="http://poj.grids.cn/modifyuser">Update your info</A><BR><A
href="http://poj.grids.cn/userlist">Authors ranklist</A><BR><INPUT size=10
name=key><INPUT type=submit value=Search name=B1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><FONT
color=#1a5cc8>Current Contest</FONT><BR><A
href="http://poj.grids.cn/pastcontests">Past Contests</A><BR><A
href="http://poj.grids.cn/contests"><FONT color=red>Scheduled
Contests</FONT></A><BR><A
href="http://poj.grids.cn/awardcontest_announce.htm" target=_blank><FONT
color=red>Award Contest</FONT></A></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"
align=left>Welcome<BR><A
href="http://poj.grids.cn/userstatus?user_id=tatalove"
target=_parent><B>tatalove</B></A> <A
href="http://poj.grids.cn/login?action=logout&url=/problem?id=2808">Log
Out</A><BR><A href="http://poj.grids.cn/mail" target=_parent><FONT
color=blue>Mail:0(<B>0</B>)</FONT></A></TD></TR></TBODY></TABLE>
<TABLE width="100%" background="2808 -- 校门外的树.files/table_back.jpg" border=0>
<TBODY>
<TR>
<TD>
<P align=center><FONT color=blue size=5>校门外的树</FONT> <BR>Time
Limit:1000MS Memory Limit:65536K<BR>Total Submit:4467 Accepted:1952
</P>
<P><FONT color=blue size=5>Description</FONT><BR><FONT
face="Times New Roman"
size=3>某校大门外长度为L的马路上有一排树,每两棵相邻的树之间的间隔都是1米。我们可以把马路看成一个数轴,马路的一端在数轴0的位置,另一端在L的位置;数轴上的每个整数点,即0,1,2,……,L,都种有一棵树。
<BR>马路上有一些区域要用来建地铁,这些区域用它们在数轴上的起始点和终止点表示。已知任一区域的起始点和终止点的坐标都是整数,区域之间可能有重合的部分。现在要把这些区域中的树(包括区域端点处的两棵树)移走。你的任务是计算将这些树都移走后,马路上还有多少棵树。
<BR></FONT></P>
<P><FONT color=blue size=5>Input</FONT><BR><FONT face="Times New Roman"
size=3>输入的第一行有两个整数L(1 <= L <= 10000)和 M(1 <= M <=
100),L代表马路的长度,M代表区域的数目,L和M之间用一个空格隔开。接下来的M行每行包含两个不同的整数,用一个空格隔开,表示一个区域的起始点和终止点的坐标。</FONT></P>
<P><FONT color=blue size=5>Output</FONT><BR><FONT face="Times New Roman"
size=3>输出包括一行,这一行只包含一个整数,表示马路上剩余的树的数目。</FONT></P>
<P><FONT color=blue size=5>Sample Input</FONT><BR><FONT
face="Times New Roman" size=3><PRE>500 3
150 300
100 200
470 471
</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Sample Output</FONT><BR><FONT
face="Times New Roman" size=3><PRE>298</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Source</FONT><BR><FONT face="Times New Roman"
size=3><A
href="http://poj.grids.cn/searchproblem?field=source&key=noip2005普及组">noip2005普及组</A></FONT></P></TD></TR></TBODY></TABLE><FONT
color=#333399 size=3>
<P align=center>[<A
href="http://poj.grids.cn/submit?problem_id=2808">Submit</A>] [<A
href="javascript:history.go(-1)">Go Back</A>] [<A
href="http://poj.grids.cn/problemstatus?problem_id=2808">Status</A>]
[<A href="http://poj.grids.cn/bbs?problem_id=2808">Discuss</A>] </FONT></P>
<P><IMG height=30 src="2808 -- 校门外的树.files/home.gif" width=40 border=0><FONT
size=3><A href="http://poj.grids.cn/">Home Page</A> </FONT> <IMG
height=30 src="2808 -- 校门外的树.files/goback.gif" width=40 border=0><FONT size=3><A
href="javascript:history.go(-1)">Go Back</A> <IMG height=30
src="2808 -- 校门外的树.files/top.gif" width=40 border=0><A
href="http://poj.grids.cn/problem?id=2808#top">To top</A></FONT><BR>
<HR>
<P style="FONT-FAMILY: Arial," align=center sans-serif Helvetica,>All Rights
Reserved 2003-2006 Ying Fuchen,Xu Pengcheng,Xie Di<BR>Any problem, Please <A
href="mailto:xiedipoj@yahoo.com">Contact Administrator</A></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -