上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 37 下一页

2014年5月14日

Hdu 1496 hash

摘要: 题目链接对于方程 a*x1^2 + b*x2^2 + c*x3^2 + d*x4^2 = 0 ( -50 File Name: 1496.cpp 3 > Author: Stomach_ache 4 > Mail: sudaweitong@gmail.com 5 > Cre... 阅读全文

posted @ 2014-05-14 18:34 Stomach_ache 阅读(123) 评论(0) 推荐(0)

2014年5月13日

python中defaultdict类

摘要: 回宿舍前翻翻Codeforces的时候发现了一个有趣的代码..其实是我没这么用过 :D这是一份417B的代码 1 import sys 2 from collections import defaultdict 3 4 n = int(sys.stdin.readline()) 5 d = def... 阅读全文

posted @ 2014-05-13 23:18 Stomach_ache 阅读(186) 评论(0) 推荐(0)

Hdu 2522 hash

摘要: 题目链接题意:输入整数n (1 1, 被除数初始left = 1, 做除法时, 如果left File Name: 2522.cpp 3 > Author: Stomach_ache 4 > Mail: sudaweitong@gmail.com 5 > Created ... 阅读全文

posted @ 2014-05-13 22:57 Stomach_ache 阅读(139) 评论(0) 推荐(0)

Hdu 1800 字符串hash

摘要: 题目链接题意: 给出n(n File Name: 1800.cpp 3 > Author: Stomach_ache 4 > Mail: sudaweitong@gmail.com 5 > Created Time: 2014年05月13日 星期二 20时12分31秒 6 ... 阅读全文

posted @ 2014-05-13 21:35 Stomach_ache 阅读(217) 评论(0) 推荐(0)

为什么printf()用%f输出double型,而scanf却用%lf呢?

摘要: 之前没有注意过这个问题, 转自:http://book.51cto.com/art/200901/106880.htm问:有人告诉我不能在printf中使用%lf。为什么printf()用%f输出double型,而scanf却用%lf呢?答:printf的%f说明符的确既可以输出float型又可以输... 阅读全文

posted @ 2014-05-13 20:49 Stomach_ache 阅读(971) 评论(0) 推荐(0)

BKDRHash算法的初步了解

摘要: 字符串hash最高效的算法, 搜了一下, 原理是:字符串的字符集只有128个字符,所以把一个字符串当成128或更高进制的数字来看,当然是唯一的这里unsigned不需要考虑溢出的问题, 不过周神说:碰撞率很小是因为n阶多项式最多n个根. 也是有道理的.最后 hash & 0x7FFFFFFF 只是为... 阅读全文

posted @ 2014-05-13 20:08 Stomach_ache 阅读(2221) 评论(0) 推荐(0)

LeetCode---Remove Nth Node From End of List

摘要: 题目链接题意: 给出单链表头指针head和整数n, 要求删除链表的倒数第n个结点, 这里n保证是合法的输入.我的思路....其实我没大明白题目建议的one pass是什么意思, 可能就是遍历一遍链表的, 不过我还是秉着能A掉就万岁的心态...我还是首先记录了链表的长度, 然后删除第len - n +... 阅读全文

posted @ 2014-05-13 19:28 Stomach_ache 阅读(247) 评论(0) 推荐(0)

字符串Hash算法比较

摘要: 基本概念所谓完美哈希函数,就是指没有冲突的哈希函数,即对任意的 key1 != key2 有h(key1) != h(key2)。设定义域为X,值域为Y, n=|X|,m=|Y|,那么肯定有m>=n,如果对于不同的key1,key2属于X,有h(key1)!=h(key2),那么称h为完美哈希函数,... 阅读全文

posted @ 2014-05-13 09:39 Stomach_ache 阅读(3481) 评论(0) 推荐(0)

2014年5月12日

LeetCode---Remove Duplicates from Sorted List II

摘要: 题目链接题意: 给出单链表的head指针, 要求去除链表中所有出现重复的元素, 如1->2->3->3->4->4->5, 返回1->2->5这题纠结了有两天, 重要的是把思路想清楚然后就可以痛苦的A掉, 不然老是会绕来绕去...我的大体思路是这样的: 使用三个指针 pre保存链表中前一个没有出现重... 阅读全文

posted @ 2014-05-12 22:04 Stomach_ache 阅读(122) 评论(0) 推荐(0)

2014年5月11日

hackerrank---Sets - Symmetric Difference

摘要: 题目链接集合操作附上代码:1 M = int(input())2 m = set(map(int, raw_input().strip().split()))3 N = int(input())4 n = set(map(int, raw_input().strip().split()))5 tmp... 阅读全文

posted @ 2014-05-11 17:17 Stomach_ache 阅读(149) 评论(0) 推荐(0)

上一页 1 ··· 16 17 18 19 20 21 22 23 24 ··· 37 下一页

导航