主要是为了试一下MILLER-RABIN的方法#include #include #include #include #define LL __int64using namespace std;const LL TIME=1000;LL random(LL n){ return (LL)((doub...
分类:
其他好文 时间:
2014-09-06 09:45:02
阅读次数:
176
Python中的random模块用于生成随机数。下面介绍一下random模块中最常用的几个函数。
random.random
random.random()用于生成一个0到1的随机符点数: 0
random.uniform
random.uniform的函数原型为:random.uniform(a, b),用于生成一个指定范围内的随机符点数,两个参数其中一个是上限,一...
分类:
编程语言 时间:
2014-09-05 23:53:52
阅读次数:
473
现在大多数网站在登陆或者是发表评论等时必须要输入验证码,这样能有效的避免暴力破解和恶意注册等不安全因素。
下面看一下如何使用JSP实现验证码功能。
首先看一下效果图:
然后看源代码。
首先看生成数字验证码的JSP页面
<%@ page language="java"
contentType="image/jpeg" import="java.util.*,java.awt.*...
分类:
其他好文 时间:
2014-09-05 16:17:11
阅读次数:
242
//中序遍历int inorder_tree_walk(BinTreeNode * root){ if(root == NULL){ return -1; } stack s; BinTreeNode * p = root; while(!s.empty(...
分类:
其他好文 时间:
2014-09-05 14:15:11
阅读次数:
142
前序遍历二叉树int preorder_tree_walk(BinTreeNode * root){ if(root == NULL){ return -1; } stack s; BinTreeNode * p = root; while(!s.empt...
分类:
其他好文 时间:
2014-09-05 14:10:51
阅读次数:
170
校验和是经常使用的,这里简单的列了一个针对按字节计算累加和。其实,这种累加和,使用将字节翻译为无符号整数和带符号整数,结果是一样的。
使用python计算校验和时记住做截断就可以了。 这里仅仅是作为一个代码样本,权作标记,直接上代码
'''
Created on 2014年9月4日
@author: lenovo
'''
import random
'''
实际计算校验和时,解释为无符号整...
分类:
编程语言 时间:
2014-09-04 22:19:30
阅读次数:
249
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
/**
* Definition for singly-lin...
分类:
其他好文 时间:
2014-09-04 19:12:40
阅读次数:
201
importjava.util.Random;importandroid.content.Context;importandroid.graphics.Bitmap;importandroid.graphics.Canvas;importandroid.graphics.Color;importan...
分类:
其他好文 时间:
2014-09-03 19:45:27
阅读次数:
332
冒泡排序,顾名思义,按照一定的规则,把数据一直排下去直接上代码 1 import random 2 3 def bubblesort(data): 4 change=True 5 for i in range(len(data)-1,1,-1): 6 for j i...
分类:
编程语言 时间:
2014-09-03 12:54:46
阅读次数:
184