Created
January 10, 2016 08:51
-
-
Save whatalnk/62920270147e01c33b24 to your computer and use it in GitHub Desktop.
AtCoder ABC #008
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s, t = gets.chomp.split(" ").map(&:to_i) | |
puts t - s + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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