不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

Problem 1

上一篇 / 下一篇  2009-09-08 10:18:55 / 个人分类:projecteuler题目 ruby实现

每日随笔
  • 每日随笔:
#   Problem 1
M,kH3n;EK&]N0#If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
#\pVO-Z*BT F'?;j J y0#Find the sum of all the multiples of 3 or 5 below 1000.
1i(mf`3a5Q3Z0
I$JM o7mV,w0=begin
s^/i4o2E no)T0def n(a,b)
f?NW.@0{-cCi0sum =0
^"_Q@"g0b.upto(a){|n| sum+=n if n % 3 ==0 or n%5 ==0}
W.l8``1L2PA'[0return sum51Testing软件测试网+w#s2r8H(AY)u
end 51Testing软件测试网yT,K F9e qw]*FRt\
p n(999,1)
pQ h;Y[5L"N{#]6BL5c9U0=end

TAG:

 

评分:0

我来说两句

Open Toolbar