Created
February 25, 2017 13:44
-
-
Save whatalnk/db740f6b7b232527492cdfadedd62662 to your computer and use it in GitHub Desktop.
AtCoder ABC #055 [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
n = gets.chomp.to_i | |
x = 800 * n | |
y = (n / 15) * 200 | |
puts x - y |
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
require 'prime' | |
h = Hash.new(0) | |
n = gets.chomp.to_i | |
1.upto(n) do |i| | |
Prime.prime_division(i).each do |a, b| | |
h[a] += b | |
end | |
end | |
ret = 1 | |
h.each do |k, v| | |
ret *= (k ** v) % (10**9 + 7) | |
end | |
puts ret % (10**9 + 7) |
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, m = gets.chomp.split(" ").map(&:to_i) | |
ret = 0 | |
if n >= m / 2 then | |
ret += (m / 2) | |
else | |
ret += n | |
ret += ((m - 2 * n) / 4) | |
end | |
puts ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment