http://acm.mipt.ru/judge/problems.pl?problem=002
问两个集合的交集是什么?
根据数据范围扫一下就行了。。。
代码:
function rt()
return io.stdin:read("*n")
end
function rtable()
local ans={}
repeat
local a=rt()
if ans[a]==nil then ans[a]=0
elseif a~=-1 then ans[a]=ans[a]+1 end
until a==-1
return ans
end
local a=rtable()
local b=rtable()
find=false
for i=1,1e6 do
if a[i]~=nil and b[i]~=nil then
print (i)
find=true
end
end
if not find then
print("empty")
end