- 博客(64)
- 资源 (16)
- 收藏
- 关注
原创 Python实现FTP上传文件或文件夹(递归)
__author__ = 'dacxu'__mail__ = 'xudacheng06.com'__date__ = '2013-10-29'__version = 1.0import sysimport osimport jsonfrom ftplib import FTP_XFER_FILE = 'FILE'_XFER_DIR = 'DIR'class Xfer(ob
2013-10-29 21:46:52 20048 3
原创 学用bat脚本
1, 启动cmd, 并且设置当前路径为"e:\" start cmd.exe /k "cd /d e:\"2, 杀死进程taskkill /IM notepad.exe /f3,把d:\test目录下所有文件删除cd /d "d:\test"del /s /q /f *.* for /d %%i in (*) do rd /s /q "%%i"
2013-08-02 14:46:58 789
原创 Python学习笔记系列(二):安装第三方软件库(Windows)
1, 一般方式 python setup.py install p.s. 安装包在C:\Python27\Lib\site-packages\ 使用该包时,只要直接导入就可以了。2, easy_install方式 首先下载setuptools安装,https://pypi.python.org/pypi/setuptools#fi
2013-07-26 12:17:29 6207
原创 Python学习笔记系列(一):异常
try: except : # if name1 is raisedexcept : # if name2 is raisedexcept (name3, name4): # if name3 or name4 raisedexcept: # if all other exceptions are raised else: #if
2013-07-24 23:09:06 15548
原创 引用变量
引用是已定义变量的别名。引用变量的主要用途是用作函数形参。通过将引用变量用作参数,函数将使用原始数据,而不是其拷贝。1 创建引用变量int rats =101;int& refRats =rats;那么:&rats == &refRats.引用更接近于const指针,必须在创建时进行初始化,一旦与某个变量关联起来,就一直绑定。因此,int & refRats = rat
2012-09-05 12:21:54 1010
原创 判断单链表是否存在环及寻找环的入口点
判断链表是否存在环,有如下几种解法:1. 遍历链表,将已经遍历过的节点放在一个hash表中,如果一个节点已经存在hash表中,说明有环。时间:O(n) 空间:O(n)2. 反转链表。 时间O(n),空间O(1),使用三个指针。(ref: http://www.cppblog.com/tx7do/archive/2009/01/06/71280.html) 单链表反转:下面给出两
2012-07-01 10:42:52 8164 2
原创 异或操作的应用
1,异或运算的规则:a) 0 xor 0 = 0b) 0 xor 1 = 1c) 1 xor 0 = 1d) 1 xor 1 = 02, 异或运算的性质:a) a xor a = 0b) (a xor b) xor c = a xor (b xor c)c) IF a xor b = c THEN a xor c = a xor (a xor b)
2012-06-18 17:13:22 2989
原创 C/C++启动函数
今天在看《Windows核心编程》第四章,其中我感兴趣的是关于启动函数的描述。启动函数的用途如下:1,获取指向新进程的完整命令行的一个指针;2,获取指向新进程的环境变量的一个指针;3,初始化C/C++运行库的全局变量4,初始化所有全局和静态C++类对象的构造函数。对于一个程序而言,在执行main函数之前会执行crtexe.c文件中mainCRTStartup或wmain
2012-02-28 00:09:12 5088
转载 Windows消息分流器
Windows消息循环讲的比较好的一篇博文原谅链接: http://blog.csdn.net/hopkins9961629/article/details/588184windows操作系统使用消息处理机制,那么,我们所设计的程序如何才能分辨和处理系统中的各种消息呢?这就是消息分流器的作用.简单来说,消息分流器就是一段代码,在我的讲述中,将分7重来循序渐进的介绍它.从最初
2012-01-10 22:21:51 569
原创 《com原理与应用》第4章聚合示例程序--执行流程
最近在看《Com原理与应用》这本书,在第4章看聚合时被卡住了,昨天搞了一个晚上没搞清楚,今天早上接着调试,把所有的函数都进行Log记录,最终发现了问题所在。开始未能理解其中的微妙, 不明白为什么明明调用的是QueryInterface函数,实际上去调用了一个不相干的函数NondelegationQueryInterface。后来从下面这个链接中知道了其中的关键所在,又回想起侯捷翻译的《C++对象模
2012-01-08 15:31:37 511
转载 从小函数实现看应聘者的编程素质(atoi.strcmp...)
原文地址:http://note.sdo.com/u/1557869253/n/sSPb5~jxCxAMLX01k00a0516:42在程序员面试的时候,面试官通常会让你实现一个或几个C语言里的库函数,以此来检查你的编程功底。类似的函数实现有atoi.itoa.a
2011-10-14 21:16:52 604
原创 pku+acm+1011
搜索类的题目,参考自:http://hi.baidu.com/alpc29_33/blog/item/43205f10c41dc377ca80c488.html纠结了N天的一道题。#include #include #include #include using namespace std;int parts[65];int used[65];int num_par
2011-10-14 08:25:11 802
原创 pku acm 1010
参考了http://blog.csdn.net/huxin2007/article/details/6766074的文章。类似于究举法。主要思路:1. 先对输入按面值的从小到大排序,这对剪枝有帮助,比如: 输入面值:1,2,3,4,5 顾客
2011-10-08 21:24:16 1008
原创 pku acm 1032
有两种方法求解,(1)递归分解,这种方法很好想,但是超时(2)分析题目,得出一些基本规律。(参考了他人的想法)1, a[1] > 1Proof: If a[1] = 1, a[t] could be replacedby a[t] + 1 and a[t]+
2011-09-30 10:00:36 582
原创 Perl -d 调试perl程序
在控制台输入perldoc perldebug即可如何得到如何调试perl程序的文档。其中重要的命令如下:p expr Same as "print {$DB::OUT} expr" in the current package. In
2011-09-28 13:21:51 4473 1
原创 pku acm 1087
第一次碰到最大流的问题。虽然我知道最大流的算法,但是砬到这题是根本没想到用最大流来求解。解法参考了http://www.cppblog.com/NARUTOACM/archive/2010/03/01/108680.html。解决此题的关键在于流图的建立:1,
2011-09-27 19:08:59 728
翻译 Levenshtein distance
Levenshtein distanceThe Levenshtein distance is a metric for measuring the amount of difference between two sequences (i.e. an edit di
2011-09-26 19:27:37 1364
原创 HashTable的一个详细实现
注:修改完善于一个粗糙版本http://blog.csdn.net/aishen944/article/details/14835161,修改了原文代码中的错误2,主要解决了在扩容时hash效率较差的问题 #ifndef _HASHTABLE_H #de
2011-09-23 21:43:50 2581
翻译 cstdarg可变参数列表
va_listType to holdinformation about variable argumentsThis type is used as a parameter for the macros definedin cstdarg to retrieve t
2011-09-23 16:06:44 712
转载 查看宏展开之后的代码
原文来自:dadaguo3000的专栏#include #define MIN(x, y) (x < y ? x : y) #define TO_STRING(x) TO_STRING1(x) #define TO_STRING1(x) #
2011-09-22 16:26:17 1828
转载 HashTable实现
Hash函数,摘自glib中typedef char gchar; typedef short gshort; typedef long glong; typedef int gint; typedef gint gboolean;
2011-09-22 14:30:30 629
转载 pku acm 1077(双向宽度优先解法及HashTable优化算法)
原文来自:http://hi.baidu.com/gropefor/home 的博客中,代码写的非常精巧,强烈推荐。在第二版的优化中使用了HashTable来加速查询。这两个代码使我了解了两种算法,一种是双向宽度优先搜索,另一种就是实际的HashTable的应用,以前一直听说Ha
2011-09-22 14:12:34 1182
原创 pku acm 1077
非常经典的8数码问题,主要采用的算法是人工智能中的“有序搜索算法”,也有人称之为A算法。#include #include #include #include #include using namespace std;const int LEN
2011-09-21 21:46:05 603
原创 pku acm 1065
//贪心算法 #include #include #include #include using namespace std;typedef pair PINTINT;bool cmp1(PINTINT p1, PINTINT p2){ if (p1.
2011-09-21 12:02:21 538
原创 pku acm 1035
//Spell checker#include #include #include #include using namespace std;set dic;string dictxt[10005];int index = 0;bool isInDic
2011-09-20 22:06:19 461
原创 pku acm 1064
二分搜索的应用#include #include #include using namespace std;int intCables[10002];//单位cmbool numberCuts(int index,int k,int length)//c
2011-09-18 18:42:34 663
原创 pku acm 1061
解题思想:(x + step * m) % L = (y + step * n) % L则(x - y + step * (m - n) ) % L == 0 || ( y - x + step * (n - m)) % L == 0则(x - y + step
2011-09-12 10:46:03 546
原创 pku acm 1095
Trees Made to Order#include #include #include using namespace std;const int LEN = 30;class OrderTree{private: static int kinds[L
2011-09-11 09:48:15 483
原创 指向类的数据成员和函数指针
指向类成员的指针在C++语言中,可以定义一个指针,使其指向类成员或成员函数,然后通过指针来访问类的成员。这包括指向属性成员的指针和指向成员函数的指针。à 指向数据成员的指针在C++语言中,可以定义一个指针,使其指向类成员。当属性成员为静态和非静态时,指针的使用也有不同
2011-09-09 16:18:41 2795
原创 while(cin)的理解
Jery最早的意图是支持一个iostream class object的纯量测试,像这样:if ( cin )...为了让cin能够求得一个真假值,Jerry首先为它定义一个conversion运算符,即operator int()。在良好行为如上者,确实 可以正确运行。
2011-09-07 16:11:16 2143
原创 pku acm 1018
题目: http://poj.org/problem?id=1018解题报告:1)方式一(对应maxbp)分为两个集合S和S1:1:初始情况下S[ (65535, 0) ], S1 [ ]为空 输入第一批数据后:(100 25)( 150
2011-09-05 23:10:23 749
原创 vector中清除某个元素方法(erase)
给一个vector对象,如何实现遍历一个删除一个。这个问题主要考察vector的erase函数。erase函数的声明如下:iterator erase(iterator_Where);iterator erase(iterator_First,iterator_L
2011-09-05 14:27:11 10165
原创 pku acm 1017
#include #include #include using namespace std;int main(){ freopen("in.txt","r",stdin); int product[7]; while(cin>>product[1]>>p
2011-09-05 09:26:02 568
原创 pku acm 1029
#include #include #include using namespace std;int flg[1001];//标记硬币:0:初始状态;1:可疑的;2:正常的硬币int comp[100][1001];//存放比较过程char res[100];//存
2011-09-04 14:27:26 651
原创 pku acm 1014
/*Source CodeProblem: 1014 User: xudacheng06Memory: 284K Time: 0MSLanguage: C++ Result: Accepted Source Code*/ #include
2011-09-03 21:10:37 584
原创 字符特性char_traits定义,及其特化版本char_traits<char>,char_traits<wchar_t>
// iosfwd standard header#if _MSC_VER > 1000#pragma once#endif#ifndef _IOSFWD_#define _IOSFWD_#include #include #include #inc
2011-09-03 14:28:48 2858
翻译 Operator new函数
operator newvoid* operator new (std::size_t size) throw (std::bad_alloc);void* operator new (std::size_t size, const std::nothrow_t& no
2011-09-02 22:55:32 1111 1
原创 C++ Utilities四(Uninitialized memory的使用)
以下三个函数定义为头文件memory中,下面是其可能的实际代码。代码来源于《The C++ Standard Library》namespace std{ template void uninitialized_fill(ForwIter beg,ForwIter end
2011-09-02 22:42:34 742
转载 new 与 operator new,placement new
"placement new"? 它到底是什么东东呀?我也是最近几天才听说,看来对于C++我还差很远呀!placement new 是重载operator new的一个标准、全局的版本,它不能被自定义的版本代替(不像普通的operator new和operator delet
2011-09-02 21:26:02 448
C++标准程序库源代码(The C++ Standard Library)
2011-08-28
Visual C++ 6.0数据库编程大全
2008-10-09
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人