Create a gist now

Instantly share code, notes, and snippets.

AtCoder ARC #003
n = gets.chomp.to_f
grades = gets.chomp.split("")
gpa = 0
grades.each do |g|
case g
when "A"
gpa += 4
when "B"
gpa += 3
when "C"
gpa += 2
when "D"
gpa += 1
end
end
puts gpa / n
# [B: さかさま辞書 - AtCoder Regular Contest 003 | AtCoder](http://arc003.contest.atcoder.jp/tasks/arc003_2)
n = gets.chomp.to_i
words = []
n.times do
words << gets.chomp.reverse
end
words.sort.each do |w|
puts w.reverse
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment