USACO 1.2-Milking Cows
2010-06-17 13:45
309 查看
题目:Milking Cows
我是用的简单的模拟,总之先AC了。
我是用的简单的模拟,总之先AC了。
{ ID:asdcyt01 PROB:milk2 LANG:PASCAL } program milk2(input,output); var n,i,j,b,e:longint; count1,count2,maxn,minn,max,max2:longint; a:array[1..1000000]of boolean; begin assign(input,'milk2.in');reset(input); assign(output,'milk2.out');rewrite(output); readln(n); maxn:=1;minn:=maxlongint; fillchar(a,sizeof(a),false); for i:=1 to n do begin readln(b,e);dec(e); for j:=b to e do a[j]:=true; if e>maxn then maxn:=e; if b<minn then minn:=b; end; count1:=0;count2:=0;max:=0;max2:=0; for i:=minn to maxn do begin if not a[i] then inc(count1) else begin if count1>max then max:=count1; count1:=0; end; if a[i] then inc(count2) else begin if count2>max2 then max2:=count2; count2:=0; end; end; if count2>max2 then max2:=count2; writeln(max2,' ',max); close(input);close(output); end .
相关文章推荐
- usaco 1.2 Milking Cows
- USACO Section 1.2 Milking Cows
- usaco 1.2 Milking Cows(类hash表)
- USACO 1.2 Milking Cows (枚举)
- 【USACO1.2_1】★Milking Cows 挤牛奶
- USACO Section1.2 Milking Cows
- USACO-Section1.2 Milking Cows
- USACO 1.2 Milking Cows
- USACO 1.2 Milking Cows (归并排序+离散化)
- USACO Section 1.2 Milking Cows
- 【USACO-Chapter1-1.2】【模拟】Milking Cows
- usaco 1.2:Milking Cows
- USACO 1.2 Milking Cows
- USACO-Section 1.2 Milking Cows[数组模拟]
- USACO-Section1.2 Milking Cows
- USACO Section 1.2 Milking Cows 解题报告
- USACO 1.2-Milking Cows
- USACO 1.2 Milking Cows(暴力枚举)
- USACO 1.2 Milking Cows (milk2)
- USACO--1.2 Milking Cows