逖靖寒的世界

每天进步一点点

导航

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页

2007年11月21日 #

如何高效求2个整数的乘积。

摘要: 利用减治法的思想来实现, 将2个整数相乘只需要进行简单的加法和位运算。 实现如下: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace ConsoleApplication43 6{ 7 class Program 8 { 9 static... 阅读全文

posted @ 2007-11-21 15:02 逖靖寒 阅读(895) 评论(4) 推荐(0) 编辑

如何高效地判断奇数和偶数

摘要: 在我们日常的编程当中,常常会遇到判断某个整数属于奇数还是偶数的情况。 大家一般的处理做法是用这个整数和2取模。然后判断是等于1还是等于0。 这里,我要为大家介绍一种快速有效的判断做法,利用2进制进行判断。 大家都知道,奇数的最低位一定是1,而偶数的最低位一定是0.所以我们可以根据这个特性,让需要判定的整数和1进行“与”运算,这样就只留下了原数的最低位,然后直接判断这个数等于1还是等于0即可。... 阅读全文

posted @ 2007-11-21 14:22 逖靖寒 阅读(11008) 评论(50) 推荐(0) 编辑

2007年11月17日 #

编程实现1到N个数的所有排列组合

摘要: 编程实现1到N个数的所有排列组合。 如: n = 3 则得到的序列如下:123, 132, 213, 231, 312, 321 我的实现如下,大家看看如何: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace ConsoleApplication42 6{ ... 阅读全文

posted @ 2007-11-17 21:44 逖靖寒 阅读(7861) 评论(7) 推荐(0) 编辑

2007年11月14日 #

减治法:C#实现插入排序

摘要: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace InsertionSort 6{ 7 class Program 8 { 9 static void Main(string[] args) 10 { 11 ... 阅读全文

posted @ 2007-11-14 17:51 逖靖寒 阅读(685) 评论(0) 推荐(0) 编辑

2007年11月13日 #

分治法:用C#实现快速排序

摘要: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace QuickSort 6{ 7 class Program 8 { 9 static void Main(string[] args) 10 { 11 ... 阅读全文

posted @ 2007-11-13 13:08 逖靖寒 阅读(1122) 评论(5) 推荐(1) 编辑

2007年11月12日 #

分治法:用C#实现归并排序

摘要: 根据《算法设计与分析基础》中对归并排序的描述,写了一分C#代码实现。 具体的实现代码如下: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace MergeSort 6{ 7 class Program 8 { 9 stat... 阅读全文

posted @ 2007-11-12 14:44 逖靖寒 阅读(2082) 评论(3) 推荐(0) 编辑

今天突然理解了“volatile”

摘要: 首先咱们可以看一下MSDN对volatile的定义: The volatile keyword indicates that a field can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread. The s... 阅读全文

posted @ 2007-11-12 12:36 逖靖寒 阅读(5366) 评论(7) 推荐(0) 编辑

2007年11月4日 #

将数字转换为中文表示

摘要: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace ConvertNum2Chinese 6{ 7 class Program 8 { 9 private Dictionary _numCharacter; 10 ... 阅读全文

posted @ 2007-11-04 19:24 逖靖寒 阅读(1551) 评论(1) 推荐(0) 编辑

求解2个数的最大公约数 和 求解质因数

摘要: 1using System; 2using System.Collections.Generic; 3using System.Text; 4 5namespace GCD 6{ 7 class Program 8 { 9 static void Main(string[] args) 10 { 11 ... 阅读全文

posted @ 2007-11-04 09:08 逖靖寒 阅读(1029) 评论(0) 推荐(0) 编辑

2007年10月30日 #

RoboCup China Open 2007

摘要: 从10月14号开始着手准备RCR(机器人仿真救援)到比赛,一共历时15天,其中只有半个晚上用于编码,最后战胜了北京理工大学代表队,并且很幸运地获得了三等奖。仿真机器人3D足球也获得了三等奖。 大家都很开心,皆大欢喜。 可是实际情况并不乐观,因为新的一届还不是主要的研发力量,而且在管理和制度上还存在很多的不足,希望他们能尽快成长起来。! 阅读全文

posted @ 2007-10-30 18:11 逖靖寒 阅读(380) 评论(0) 推荐(0) 编辑

上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 19 下一页