Create a gist now

Instantly share code, notes, and snippets.

AtCoder ABC #008
s, t = gets.chomp.split(" ").map(&:to_i)
puts t - s + 1
n = gets.chomp.to_i
res = {}
n.times do
name = gets.chomp
if res.key?(name) then
res[name] += 1
else
res[name] = 1
end
end
puts res.key(res.values.max)
n = gets.chomp.to_i
cc = readlines.map(&:to_i)
res = 0.0
cc.each do |c|
k = 0
cc.each do |f|
k += 1 if c % f == 0
end
if k.even? then
res += (k / 2.0) / k
else
res += ((k + 1) / 2.0) / k
end
end
puts res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment