Last active
March 9, 2017 08:44
-
-
Save whatalnk/b49473633d0545cd9e0bfa0bfaba962a to your computer and use it in GitHub Desktop.
みんなのプロコン
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
h = Hash.new(0) | |
gets.chomp.split("").each do |s| | |
h[s] += 1 | |
end | |
if h["y"] == 1 && h["a"] == 1 && h["h"] == 1 && h["o"] == 2 then | |
puts "YES" | |
else | |
puts "NO" | |
end |
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, k = gets.chomp.split(" ").map(&:to_i) | |
a = gets.chomp.split(" ").map(&:to_i).sort | |
puts a[0...k].inject(:+) + (0...k).inject(:+) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment