Created
October 7, 2017 14:01
-
-
Save whatalnk/3ab9d7bea10ca184766f966433bdf2a0 to your computer and use it in GitHub Desktop.
DDCC 2017 予選
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
s = gets.chomp | |
if s[0] == s[1] && s[1] != s[2] && s[2] == s[3] | |
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
a, b, c, d = gets.chomp.split(" ").map(&:to_i) | |
puts a * 1728 + b * 144 + c * 12 + d |
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, c = gets.chomp.split(" ").map(&:to_i) | |
l = [] | |
n.times do |i| | |
l << [gets.chomp.to_i, i] | |
end | |
l.sort_by!{|x| x[0]} | |
ans = n | |
l.each do |ll| | |
x = l.pop | |
if x[1] == ll[1] | |
break | |
elsif ll[0] + x[0] + 1 <= c | |
ans -= 1 | |
else | |
redo | |
end | |
end | |
puts ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment