2008年10月20日

An interesting climate

摘要: HANS: Where do you come from? JIM: I come from England. HANS: What's the climate like in your country? JIM: It's mild, but it's not always pleasant. JIM: The weather's often cold in North and windy in... 阅读全文

posted @ 2008-10-20 09:55 胖兔子 阅读(137) 评论(0) 推荐(0)

2008年10月15日

java English:overloading and overriding

摘要: Overloading a method is what you have already learned: providing more than one method with the same name but with different signatures to distinguish them. * Overriding a method means rep... 阅读全文

posted @ 2008-10-15 10:17 胖兔子 阅读(134) 评论(0) 推荐(0)

2008年10月11日

给定一个运算规则,让其在最短的步骤之内达到1

摘要: 给定一个数字n,如果n是偶数就让n/2,如果是奇数就让n +1或-1,例 n = 31; n = n - 1; //30 n = n / 2; //15 n = n + 1; //16 n = n / 2; //8 n = n / 2; //4 n = n / 2; //2 n = n / 2; //1 问:怎样能够以最少的计算次数,算出n = 1; csdn一网友给的算法:... 阅读全文

posted @ 2008-10-11 22:02 胖兔子 阅读(149) 评论(0) 推荐(0)

2008年10月10日

【原创】输出三角形矩阵

摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/**输出下列矩阵 1 5 2 8 6 3 10 9 7 4 输入 n,则输出 n 行这样的矩阵 对于java可以构造这样的2维动态梯形数组,模仿这个矩阵 {1},{5,2},{8,... 阅读全文

posted @ 2008-10-10 11:24 胖兔子 阅读(669) 评论(0) 推荐(0)

一错误递归的例子

摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->csdn上,一网友想用递归实现如下: 我要实现如下功能,比如一个数字是199。第一步199--1+9+9=19 第二步 19--1+9=10 第三步 10--1+0=1 直到结果是个位数为止。 当... 阅读全文

posted @ 2008-10-10 09:50 胖兔子 阅读(239) 评论(0) 推荐(0)

常用正则表达式

摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->1。^\d+$ //匹配非负整数(正整数 + 0) 2。^[0-9]*[1-9][0-9]*$ //匹配正整数 3。^((-\d+)|(0+))$ //匹配非正整数(负整数 + 0) 4。^-... 阅读全文

posted @ 2008-10-10 09:48 胖兔子 阅读(661) 评论(0) 推荐(0)

O(n)判断该数组内是否有重复的数

摘要: 100个整数(取值范围为[1,100],存在一个数组arr[100]中 请写一个函数,判断该数组内是否有重复的数? 限制:时间复杂度为O(N)与空间复杂度O(1) 另:在该限制下,能判断是哪个(或哪些)数字重复么? csdn一网友发表他的高见: 我根据其描述写了算法 最终解决方案: Code highlighting produced by Actipro CodeHighlighte... 阅读全文

posted @ 2008-10-10 09:34 胖兔子 阅读(1307) 评论(0) 推荐(0)

导航