Re: [QUIZ] Price Ranges (#164)
by Harry Kakueki other posts by this author
Jun 3 2008 7:20AM messages near this date
Re: [QUIZ] Price Ranges (#164)
|
Re: Price Ranges (#164)
>
=begin
Here is my solution.
It accepts input like this:
2500_5000 #lower_upper
2500_ #lower only
_5000 #upper only
=end
min,max = ARGV[0].split(/_/)
a,b,c = (1000..3000).to_a,(6000..10000).to_a,(500..2500).to_a
l,u = min.to_i,max.to_i
u = [a,b,c].flatten.max if max == nil
l = 0 if min == ""
cust = (l..u).to_a
p "a" unless (cust & a).empty?
p "b" unless (cust & b).empty?
p "c" unless (cust & c).empty?
Harry
--
A Look into Japanese Ruby List in English
http://www.kakueki.com/ruby/list.html
Thread:
Matthew Moss
Sharon and Dave
Matthew Rudy Jacobs
Sharon and Dave
Steven Hahn
Harry Kakueki
Toby O'Rourke
jgabrielygalan
Steven Hahn
Andrea Fazzi
S2
Matthew Moss
Matthew Moss
Robert Dober
|