Last active
March 19, 2017 11:17
-
-
Save whatalnk/6f918dbe97af36fe1f80406151e9c629 to your computer and use it in GitHub Desktop.
AtCoder ABC #012 [Ruby]
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
a, b = gets.chomp.split(" ").map(&:to_i) | |
puts "#{b} #{a}" |
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 | |
h = n / 3600 | |
n -= h * 3600 | |
m = n / 60 | |
n -= m * 60 | |
printf("%02i:%02i:%02i\n", h, m, n) |
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 | |
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