Skip to content

Instantly share code, notes, and snippets.

@miyataka
Last active June 23, 2019 14:45
Show Gist options
  • Save miyataka/3f9dc3af254f4b9a482a4a49757a81a5 to your computer and use it in GitHub Desktop.
Save miyataka/3f9dc3af254f4b9a482a4a49757a81a5 to your computer and use it in GitHub Desktop.
array = gets.chomp.split(' ')
N = array[0].to_i
L = array[1].to_i
flavor_list = []
N.times do |i|
flavor_list.push(L + i)
end
bite = if N.abs > -L
flavor_list.map(&:abs).min
else
- flavor_list.map(&:abs).min
end
print flavor_list.inject(:+) - bite
i = gets.chomp
prev = ''
result = ''
i.split('').each do |k|
if k == prev
result = 'Bad'
break
else
result = 'Good'
end
prev = k
end
print result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment