题目是老赵的:
http://www.cnblogs.com/JeffreyZhao/archive/2009/06/21/1507847.html
代码如下:
1
public static IEnumerable<int[]> Compute( int min, int max, int sum, int count )
2
2
代码随手写成,仅仅只是用LINQ来实现了一下而已。事实上也能看出LINQ之强大,绝不仅仅是语法糖那么简单
另外也顺便出道小题目,大家也可以尝试用LINQ来解一下。
分解质因数,输入一个正整数,要求输出其质因数分解形式
如输入:66,应输出:
66 = 3 * 2 * 11
而
66 = 6 * 11
是错误的。
又如24,应输出:
24 = 2 * 2 * 2 * 3