01 2012 档案
[haskell] 数值的类型
摘要:Table6.1.Selected Numeric TypesTypeDescriptionDoubleDouble-precision floating point. A common choice for floating-point data.FloatSingle-precision floating point. Often used when interfacing with C.IntFixed-precision signed integer; minimum range [-2^29..2^29-1]. Commonly used.Int88-bit signed integ 阅读全文
posted @ 2012-01-31 15:40 江振 阅读(1210) 评论(0) 推荐(0)
[projectEuler.net]12
摘要:求一个数的因子的数量。X=a^n*b^m*c^p will have (n + 1)(m + 1)(p + 1) factors.//abc都是质因子28=2^2*7 will have 3*2 = 6 factors 因为:28的质因子是 2 2 7;28的所有因子必是由这些质因子构成;构造这些因子时:2可以取 0 、1、 2 个。7可以取0 、1 个;所以28因子的数量是:3×2=6 。http://mathforum.org/library/drmath/view/55843.htmlhttp://www.cnblogs.com/zhouyinhui/archive/2011/ 阅读全文
posted @ 2012-01-31 00:40 江振 阅读(291) 评论(0) 推荐(0)
[projectEuler.net] 11
摘要:In the 2020 grid below, four numbers along a diagonal line have been marked in red.08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 0081 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 6552 70 95 23 04 60 11 42 69 24 68 56 01 3 阅读全文
posted @ 2012-01-30 13:38 江振 阅读(146) 评论(0) 推荐(0)
[projectEuler.net] 10
摘要:Sieve of Eratosthenesis a simple, ancientalgorithmfor finding allprime numbersup to any given limit.///SieveofEratosthenes///http://upload.wikimedia.org/wikipedia/commons/b/b9/Sieve_of_Eratosthenes_animation.gif///内部使用byte数组存放标志位,所以不适合非常大的素数范围。视内存限制。letPrimesBelowSOEx=letmutableret=[]letflagarr=Arr. 阅读全文
posted @ 2012-01-29 16:07 江振 阅读(189) 评论(0) 推荐(0)
[projecteuler.net] 5;6;9
摘要:5欧几里德求最小公约数法f#实现:///Euclideanalgorithm///http://en.wikipedia.org/wiki/Euclidean_algorithm///求AB的最大公约数///使用辗转相减法///原始的欧几里算法是:///设C为最大公约数///A=aCB=bC///gcd(A,B)=>gcd(A-B,B)[a>b]及gcd((a-b)C,B)不断的用大的减去小的。直到a-b=1那么就得到C了letrecgcdab=matchawith|xwhenx=0I->b|_->gcd(b%a)a有了最小公约数最小公倍数就简单了letlcmab=a* 阅读全文
posted @ 2012-01-28 21:03 江振 阅读(243) 评论(0) 推荐(0)
使用MSBuild编译FsLex项目
摘要:FsLex FsYacc微软本身也提供了一个项目模板。但是这个项目模板是lex和yacc文件均包含。我想只适用lex,但是如果每次使用命令行也觉得不够方便,于是还是研究了一番MsBuild的使用。使用msbuild hellp.fsproj /v:d 可以查看整个msbuild的流程,非常白盒。hello.fsproj文件:<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="4.0" DefaultTargets="MyBuild&quo 阅读全文
posted @ 2012-01-13 15:10 江振 阅读(384) 评论(0) 推荐(0)