- 博客(22)
- 收藏
- 关注
原创 scrapy + selenium + mongodb 爬取京东搜索物品信息
爬取京东物品信息明确目标爬取商品名字,评论数,商家,价格,并进行简单分析 一, 获得起始搜索url 查看链接可以得到 : https://search.jd.com/Search?keyword=笔记本电脑 京东自营&enc=utf-8其中keyword为搜索关键字二,分析搜索页面取得xpath表达式商品名字: //div[@id="J_goodsList...
2018-08-14 12:27:34 1215 1
原创 从零撸一个RSA (JAVA)
从零撸一个RSA加密算法对于RSA算法,一个非对称加密算法,具体是用公钥加密,私钥解密。主要原理是模逆,详细的背后的数学原理参看文末链接。对于生成密钥流程: 对于加解密过程: 如此如下:辅助容器类 MyKey.javaimport java.math.BigInteger;public class MyKey { public BigIn...
2018-08-08 21:21:17 332
原创 nyoj 三个水杯
用bfs , dfs 我做不了倒水也就6种情况 然后就慢慢模拟了 #include#include #include #include using namespace std ;struct node{ int a, b , c , cnt ; void init( int i , int j , int k , int l ) {
2016-04-20 22:09:22 306
原创 poj Wireless Network
传送门 Wireless Network题意 : 给你n个坏机器的坐标,和最大沟通距离 d;给定两种操作 ‘S’ 和 'O' 第一种操作询问两个机器是否联系,第二种修复这个编号的机器 联系具有传递性 ,那么就用并查集 ; so : #include #include #include using namespac
2016-04-10 17:09:57 528
原创 poj cube stacking
传送门 cube stacking给定一堆立方体,每次move都将此方块所在的整堆都移动道另外一堆上面每次querry 输出编号下面有多少个立方体 思路并查集并且保留深度/* 刚开始没有用一个deep数组记录深度,而是直接递归寻找深度,时间爆了 诶........*/#include #include using namespace std ;con
2016-04-10 16:01:00 285
原创 UVa11971 Polygon
传送门 Polygon给定 n , k 求能构成多边形的概率;概率问题,跟长度n没有一毛钱关系 ,不能构成多边形的的条件是有一条边长度大于等于总长度的一半那么其余的k条边都应该是小于一半的,一条边只有两种可能大于或小于,那么各占一半so 概率p = 1 - (k+1)/2^k ;#include using namespace std ;typedef long l
2016-04-08 19:41:06 298
原创 Uva 10791MininumSumLCM
传送门 Uva10791 给你一个数n,求至少两个正整数,使得他们的最小公倍数为n,输出最小的和 用到了唯一分解定理 ,详情见紫书第二版 最近学了判断质数的MillerRabin 方法就用他了;代码如下#include using namespace std ;typedef long long LL ;LL mp[] = {2 , 7 , 61} ;ma
2016-04-08 18:07:03 237
原创 hihoCoder 数论一Miller-Rabin质数检测
判断一个数是否是素数 /*费马小定理:对于素数p和任意整数a,有ap ≡ a(mod p)(同余)。反过来,满足ap ≡ a(mod p),p也几乎一定是素数。 a^(p-1) = 1 ( mod p ) p为奇质数 x^2 (mod p ) = 1 如果a^(n-1) ≡ 1 (mod n)成立,Miller-Rabin算法不是立即找另一个a进行测试,而是看n-1是
2016-04-05 17:40:26 640
原创 HDU 2138
HDU 2138 传送门 HDU 2138题目描述: 给你一堆数字,判断有多少个素数应用 MillerRabin算法 #include #include #include using namespace std ;typedef long long LL ;int mp[] = { 2 , 7 , 61 } ; // 参考一位大牛的32位的只需检测这3个数,最
2016-04-05 17:28:30 327
原创 Leetcode 048
48. Rotate ImageMy SubmissionsQuestionTotal Accepted: 62135 Total Submissions: 182151 Difficulty: MediumYou are given an n x n 2D matrix representing an image.Rotate the imag
2016-03-04 15:19:27 186
原创 Leetcode 024
24. Swap Nodes in PairsMy SubmissionsQuestionTotal Accepted: 84322 Total Submissions: 243618 Difficulty: MediumGiven a linked list, swap every two adjacent nodes and return its
2016-03-04 15:04:50 208
原创 Leetcode 074
74. Search a 2D MatrixMy SubmissionsQuestionTotal Accepted: 72190 Total Submissions: 216465 Difficulty: MediumWrite an efficient algorithm that searches for a value in an m x n
2016-03-04 15:02:05 219
原创 Leetcode 059
59. Spiral Matrix IIMy SubmissionsQuestionTotal Accepted: 48287 Total Submissions: 141170 Difficulty: MediumGiven an integer n, generate a square matrix filled with elements fr
2016-03-04 14:59:05 219
原创 Leetcode 202
202. Happy NumberMy SubmissionsQuestionTotal Accepted: 57450 Total Submissions: 160293 Difficulty: EasyWrite an algorithm to determine if a number is "happy".A happy number i
2016-03-04 14:52:31 313
原创 Leetcode 263
263. Ugly NumberMy SubmissionsQuestionTotal Accepted: 44920 Total Submissions: 125009 Difficulty: EasyWrite a program to check whether a given number is an ugly number.Ugly n
2016-03-04 14:35:03 511
原创 Leetcode 206
206. Reverse Linked ListMy SubmissionsQuestionTotal Accepted: 86124 Total Submissions: 225095 Difficulty: EasyReverse a singly linked list.第一个想到的是栈,把每个节点依次存入,在出栈变可直接获得答案 ;代
2016-02-25 16:29:19 332
原创 Leetcode 318
318. Maximum Product of Word LengthsMy SubmissionsQuestionTotal Accepted: 12461 Total Submissions: 32103 Difficulty: MediumGiven a string array words, find the maximum value
2016-02-24 10:42:16 308
原创 Leetcode 260
260. Single Number IIIMy SubmissionsQuestionTotal Accepted: 25496 Total Submissions: 59777 Difficulty: MediumGiven an array of numbers nums, in which exactly two elements app
2016-02-22 12:09:40 306
原创 Leetcode 136
136. Single NumberMy SubmissionsQuestionTotal Accepted: 114785 Total Submissions: 235971 Difficulty: MediumGiven an array of integers, every element appears twice except for on
2016-02-21 19:05:17 371
原创 Leetcode 258
258. Add DigitsMy SubmissionsQuestionTotal Accepted: 70241 Total Submissions: 146130 Difficulty: EasyGiven a non-negative integer num, repeatedly add all its digits until the
2016-02-21 18:56:02 247
原创 Leetcode 142
142. Linked List Cycle IIMy SubmissionsQuestionTotal Accepted: 67741 Total Submissions: 215263 Difficulty: MediumGiven a linked list, return the node where the cycle begins. If
2016-02-21 18:33:58 246
原创 Leetcode 292
292. Nim GameMy SubmissionsQuestionTotal Accepted: 46269 Total Submissions: 90128 Difficulty: EasyYou are playing the following Nim Game with your friend: There is a heap o
2016-02-21 18:22:35 354
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人