Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active March 19, 2017 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/6f918dbe97af36fe1f80406151e9c629 to your computer and use it in GitHub Desktop.
Save whatalnk/6f918dbe97af36fe1f80406151e9c629 to your computer and use it in GitHub Desktop.
AtCoder ABC #012 [Ruby]
a, b = gets.chomp.split(" ").map(&:to_i)
puts "#{b} #{a}"
n = gets.chomp.to_i
h = n / 3600
n -= h * 3600
m = n / 60
n -= m * 60
printf("%02i:%02i:%02i\n", h, m, n)
n = gets.chomp.to_i
kuku = Hash.new{|h, k| h[k] = Array.new()}
sum = 0
(1..9).each do |i|
(1..9).each do |j|
sum += i * j
kuku[i*j] << "#{i} x #{j}"
end
end
puts kuku[sum - n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment