Skip to content

Instantly share code, notes, and snippets.

@orlybg
Created July 11, 2013 01:49
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 orlybg/5971869 to your computer and use it in GitHub Desktop.
Save orlybg/5971869 to your computer and use it in GitHub Desktop.
=begin
Sample code to read in test cases:
File.open(ARGV[0]).each_line do |line|
# Do something with line, ignore empty lines
#...
end
=end
File.open(ARGV[0]).each_line do |line|
# Do something with line, ignore empty lines
#...
elems = line.split(" ")
puts "=========="
#puts elems[0]
#puts elems[1]
#puts elems[2]
1.upto(elems[2].to_i) do |i|
if (i % elems[1].to_i == 0) and (i % elems[0].to_i == 0)
puts 'FB'
elsif i % elems[0].to_i == 0
puts 'F'
elsif i % elems[1].to_i == 0
puts 'B'
else
puts i
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment