上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 46 下一页
摘要: Dict创建somedict = {}somedict = {"key": value}a = dict(one=1, two=2, three=3)c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))d = dict([('two', 2), ('on... 阅读全文
posted @ 2014-10-17 22:21 卖程序的小歪 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 这是第一次用着python感到怒了,从datetime转化到timestamp数值居然没有直接的函数直接获取当前时间戳倒是方便:import timetimestamp = time.time()把一个timestamp数值转化成datetime对象也方便:import timeimport dat... 阅读全文
posted @ 2014-10-17 14:36 卖程序的小歪 阅读(1580) 评论(0) 推荐(0) 编辑
摘要: 参见:http://www.cnblogs.com/uvsjoh/archive/2012/03/27/2420120.html函数太多了,如上述文章中所述,BKDRHash算法在实现方便且表现出色,摘录其C的实现 1 unsigned int BKDRHash(char *str) 2 { 3 ... 阅读全文
posted @ 2014-10-17 08:52 卖程序的小歪 阅读(2347) 评论(0) 推荐(1) 编辑
摘要: #include #include #include using namespace std;bool double_num(vector &num) { int carry = 0; int i = num.size() - 1; while (i>=0) { in... 阅读全文
posted @ 2014-10-16 15:10 卖程序的小歪 阅读(194) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;class Node {public: vector adj; bool visited; Node() : visited(false) {}};void reset_nodes(vec... 阅读全文
posted @ 2014-10-16 10:37 卖程序的小歪 阅读(285) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std;void init_primes(vector& primes) { int len = primes.size(); for (int i=0; i rs; while... 阅读全文
posted @ 2014-10-16 09:15 卖程序的小歪 阅读(167) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std;class City {public: vector adj; bool visited; City() : visited(false) {}};void dfs(int idx, v... 阅读全文
posted @ 2014-10-16 00:07 卖程序的小歪 阅读(189) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std;class User {public: vector fellowers; bool visited; User(): visited(false){}... 阅读全文
posted @ 2014-10-15 20:09 卖程序的小歪 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 过了一天感觉没干什么,想刷一发题弥补一下,正在考虑去做哪道,室友说去试试PAT 1010,果然当年自己直接跳过了这题,一看这通过率(0.07)有点夸张了。题目是已知一个数,求另外一个数的基数,使得这两个数数值上相等。很自然的考虑到使用二分搜索来确定这个基数,数字表示使用[0-9a-z],这tmd的让... 阅读全文
posted @ 2014-10-15 16:21 卖程序的小歪 阅读(1370) 评论(1) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std;#define AGE_MAX 200class People {public: char name[9]; int worth; i... 阅读全文
posted @ 2014-10-13 01:45 卖程序的小歪 阅读(237) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 46 下一页