Created
July 11, 2013 01:49
-
-
Save orlybg/5971869 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
=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