记录编号 | 8149 | 评测结果 | ATAWWWTTTT | ||
---|---|---|---|---|---|
题目名称 | [BYVoid S3] 彩色穿孔卡片 | 最终得分 | 20 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | Pascal | 运行时间 | 5.551 s | ||
提交时间 | 2008-11-13 11:37:21 | 内存使用 | 19.19 MiB | ||
program punch; type shuzu=array[0..10000000] of integer; shuzu1=array[1..10000] of boolean; var s:shuzu; f:shuzu1; i,j,k,m,n,a,b,max,temp,c:longint; begin assign(input,'punch.in');reset(input); assign(output,'punch.out');rewrite(output); readln(n); max:=0; for i:=1 to n do begin readln(a,b); if b>max then max:=b; for j:=a+1 to b do s[j]:=i; end; temp:=s[1]; f[s[1]]:=true; c:=1; for i:=1 to max do begin if (temp<>s[i])and(not f[s[i]]) then begin inc(c);temp:=s[i]; f[s[i]]:=true; end; end; writeln(c); close(output); end.