-
-
Save whatalnk/206c1f5c24cca103a90f to your computer and use it in GitHub Desktop.
ABC#16
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
m, d = gets.chomp.split(" ").map(&:to_i) | |
if m % d == 0 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
a, b, c = gets.chomp.split(" ").map(&:to_i) | |
res1 = a + b | |
res2 = a - b | |
if res1 == res2 then | |
if res1 == c then | |
puts '?' | |
else | |
puts '!' | |
end | |
elsif res1 == c then | |
puts '+' | |
elsif res2 == c then | |
puts '-' | |
else | |
puts '!' | |
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, m = gets.chomp.split(" ").map(&:to_i) | |
friends = {} | |
(1..n).each do |k| | |
friends[k] = [] | |
end | |
while line = gets | |
a, b = line.chomp.split(" ").map(&:to_i) | |
friends[a] << b | |
friends[b] << a | |
end | |
friends.each do |k, v| | |
res = [] | |
v.each do |f| | |
res << friends[f] | |
end | |
v << k | |
puts (res.flatten.uniq - v).size | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment