Skip to content

Instantly share code, notes, and snippets.

@inohiro
Created May 27, 2012 13:29
Show Gist options
  • Save inohiro/2814217 to your computer and use it in GitHub Desktop.
Save inohiro/2814217 to your computer and use it in GitHub Desktop.
atcoder3_A
length = gets.to_i
str = gets
result = 0.0
i = 0
str.each_byte do |s|
case s
when 65 # A
result = result + 4.0
when 66 # B
result = result + 3.0
when 67 # C
result = result + 2.0
when 68 # D
result = result + 1.0
end
end
puts result / length
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment