文件名称:超越梦想 2005noip解题报告
文件大小:80KB
文件格式:DOC
更新时间:2016-11-25 11:26:15
解题报告
2005noip解题报告 program tree; uses crt; var fi,fo:text; long,m,total:word; a,b:array[1..100] of word; i,jian:integer; all:array[0..10000] of 0..1; begin clrscr; total:=0; for i:=0 to 10000 do all[i]:=1; assign(fi,'tree.in'); reset(fi); read(fi,long); read(fi,m); readln(fi); for i:=1 to m do begin read(fi,a[i]); read(fi,b[i]); readln(fi); end; for i:=1 to m do begin for jian:=a[i] to b[i] do begin all[jian]:=0; end; end; for i:=0 to long do begin if all[i]=1 then inc(total); end; assign(fo,'tree.out'); rewrite(fo); writeln(fo,total); close(fi); close(fo); end.