题解 P1469 【找筷子】

· · 题解

基数排序轻松过。。。


read(b);
for c:=1 to b do
begin
read(d);
a[d]:=a[d]+1;
end;//基数排序中
for c:=1 to 10000000 do//枚举长度
if (a[c] and 1)<>0 then    begin writeln(c); halt; end;//用位运算判断更快