pku1083 Moving Tables
2012-04-19 15:33
309 查看
最大的移动时间取决于被经过次数最多的一个房间,把每个移动看做一个区间,覆盖1-400的点,特别的,有时区间端点需要加减,因为它会影响后面一个点(前面一个点)。
View Code
View Code
program pku1083(input,output); var cover:array[0..801] of integer; x,y,n:longint; cases:longint; i,j:longint; answer:longint; procedure swap(var aa,bb:longint); var tt:longint; begin tt:=aa; aa:=bb; bb:=tt; end; begin readln(cases); while cases>0 do begin dec(cases); fillchar(cover,sizeof(cover),0); readln(n); for i:=1 to n do begin readln(x,y); if x>y then swap(x,y); if not odd(x) then dec(x); if odd(y) then inc(y); for j:=x to y do inc(cover[j]); end; answer:=0; for i:=1 to 800 do if cover[i]>answer then answer:=cover[i]; writeln(answer*10); end; end.
相关文章推荐
- pku1083: Moving Tables
- PKU 1083 Moving Tables
- pku1083 Moving Tables
- pku1083 Moving Tables
- POJ 1083 Moving Tables
- POJ 1083 Moving Tables
- POJ 1083 - Moving Tables
- POJ 1083 Moving Tables
- poj 1083 Moving Tables
- POJ-1083-Moving Tables
- POJ 1083 Moving Tables
- poj-1083-Moving Tables
- POJ 1083 Moving Tables
- poj 1083 Moving Tables
- POJ - 1083 Moving Tables
- POJ-1083 Moving Tables
- 1083 Moving Tables
- poj_1083_Moving Tables
- HDU 1050 POJ 1083 Moving Tables
- 【原创】【区间上的贪心 第二篇】POJ 1083 Moving Tables