不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           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
4P;u7jJ.^Y C0#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.51Testing软件测试网&G9l*v:t.~x;[
#Find the sum of all the multiples of 3 or 5 below 1000.
ShpEJz Z#mq0
]'f.M ^!Ro:}0=begin
9vYi z5c qK0def n(a,b)
uuVd/ZX*vd0sum =051Testing软件测试网m\7fC?r D
b.upto(a){|n| sum+=n if n % 3 ==0 or n%5 ==0}
@._ m*|7F%ui-_a@)r0return sum
r X9_W Ob0end
8o'eX3a$_9W0p n(999,1)
v#DU(A)PiRH8}0=end

TAG:

 

评分:0

我来说两句

Open Toolbar