ProjectRuler-5
2011-11-04 12:41
141 查看
#2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. #What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? #answer : 232792560 # #待修改,效率不高 def devided a = [] flag = true (1..3_0000_0000).to_a.each do |number| 2.upto(10) do |i| rod = number.to_f/i if rod != rod.to_i break else a.push(number) flag = false end end break if !flag end puts a[-1] end devided
相关文章推荐
- Project Ruler 13 给你100个50位数,求它们和的前十位
- ProjectRuler-1
- Project Ruler 算法练习之 10 进制 转 2进制 以及数字对称
- ProjectRuler-2
- ProjectRuler-3
- Project Ruler 算法练习之 Truncate Prime
- ProjectRuler-4
- ProjectRuler-7
- ProjectRuler 算法练习之 位数组成字符串相同的整数
- ProjectRuler-8
- ProjectRuler-10
- ProjectRuler 算法练习之 位数组成字符串同样的整数
- ProjectRuler-9
- Project Ruler 算法练习之除数问题
- <s:date name="project.contractStartDate" format="yyyy-MM-dd"/>
- (转)Dynamic Web project转成Maven项目
- HDU 1879 继续畅通project
- 运行project提示conversion to dalvik format failed with error 原因
- eclipse环境 Cannot run program "C:\Java\jdk1.6.0_02\bin\javaw.exe" (in directory "D:\project\SDK"): Cr
- 关于cocos2dx的eclipse的"serializing cdt project settings"解决方案