Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active January 15, 2016 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/88ca347fcbb0eda7c5e2 to your computer and use it in GitHub Desktop.
Save whatalnk/88ca347fcbb0eda7c5e2 to your computer and use it in GitHub Desktop.
Codeforces #339 Div2
n = gets.chomp.split(" ").map(&:to_i)
tanks = gets.chomp.split(" ")
pow = 0
notbeautiful = "1"
tanks.each do |t|
n1 = t.count("1")
n0 = t.count("0")
nrem = t.length - n1 - n0
if t.length == 1 && n0 == 1 then
puts 0
exit
elsif n1 != 1 or nrem != 0 then
notbeautiful = t
else
pow += t.length - 1
end
end
puts notbeautiful + "0" * pow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment