faraway  

随笔分类 -  C/C++程序

  • 一个关于inet_ntoa的奇怪问题
    摘要:无意中发现一个inet_ntoa函数的奇怪问题。 Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->#include #include #pragma comment( lib, "ws2_32.lib" ) struct socka... 阅读全文
    posted @ 2009-03-27 20:41 faraway 阅读(928) 评论(1) 推荐(0)
  • Random Shuffles
    摘要:http://www.maths.abdn.ac.uk/~igc/tch/mx4002/notes/node83.html random shuffle的原理 http://blog.csdn.net/zhaostu/archive/2007/01/19/1487912.aspx 后面一段关于播放列表random shuffle的还写的不错 阅读全文
    posted @ 2009-03-11 09:30 faraway 阅读(360) 评论(0) 推荐(0)
  • strlen源码剖析(转)
    摘要:http://www.cppblog.com/ant/archive/2007/10/12/32886.aspx 阅读全文
    posted @ 2008-08-01 20:39 faraway 阅读(359) 评论(0) 推荐(0)
  • KMP算法
    摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> 下面是自己写的一个KMP算法实现。P为待查找串,Q为模式串,B为预处理数组。 #include #include #include #define MATCH_DETA... 阅读全文
    posted @ 2008-07-20 21:42 faraway 阅读(466) 评论(0) 推荐(0)
  • 字符串中单词逆序
    摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->/**//**//**//* * 将字符串中单词出现次序逆序。 * "123 45 6" --->> "6 45 123" * * 对字符串扫描两次,第一... 阅读全文
    posted @ 2008-07-15 09:52 faraway 阅读(839) 评论(2) 推荐(0)
  • 蚂蚁和木杆问题
    摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->最巧妙的方法是把两只蚂蚁相遇之后看出互相“穿透”。下面是老老实实的计算方法,呵呵。 /**//* * 题目:有一根27厘米的细木杆,在第3厘米、7厘米、11厘米、17厘米、23厘米这... 阅读全文
    posted @ 2008-07-15 09:43 faraway 阅读(410) 评论(0) 推荐(0)
  • 计算二进制中1的个数(转)
    摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->/**//* 解法一 将二进制数的各位相加,结果即为1的个数。从两位二进制开始计算。 55555555 h = 01010101010101010101010101... 阅读全文
    posted @ 2008-07-15 09:37 faraway 阅读(435) 评论(0) 推荐(0)
  • 双向链表插入删除
    摘要:Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ -->#include #include typedef struct node_t { int data; struct node_t* ... 阅读全文
    posted @ 2008-07-15 09:29 faraway 阅读(787) 评论(0) 推荐(0)