摘要:
参考了ACdreamer大神的博客http://blog.csdn.net/acdreamers/article/details/7913786 在51nod上看了个10^30范围的素数判定,打表肯定是不行了,应该用miller-robin素数判定加java的BigInteger 首先基于fermat小定理就是gcd(a,p)=1时,a^(p-1)%p=1,所以在生成rand(2,p-1)的随机数... 阅读全文
阅读排行榜
编程之美:队列中的最大最小值
2015-01-03 11:09 by MengYu1, 397 阅读, 收藏,
摘要:
#include "iostream"
#include "memory.h"
#include "stdio.h"
#include "limits.h"
typedef int Type;
const int MAXN=15;
const int MIN=INT_MIN;
class stack
{
public: stack() { stacktop=-1;
... 阅读全文
使用mathtype在live writer中插入公式
2014-10-25 12:53 by MengYu1, 276 阅读, 收藏,
摘要:
博客园的官方贴中详细说明了怎么使用windows live writer(wlm)写博客http://home.cnblogs.com/group/topic/8550.html 下面我介绍下使用mathtype在wlm中插入公式 打开Preference下的第一个选项cut and copy preference下 选择windows live writer,之后编辑好公式,直接CTRL+A... 阅读全文
csapp:无符号数可能造成的程序bug
2014-12-27 20:01 by MengYu1, 191 阅读, 收藏,
摘要:
出自csapp练习2.26 size_t strlen(const char *s);
int strloner(char *s,char *t)
{ return strlen(s)-strlen(t);
}
乍一看没什么问题,但是size_t是定义为unsigned int的,那么当s串长度小于t串,计算结果是负数,对于无符号数既是一个很大的无符号数,这样返回结果为1,结果错误
改正可... 阅读全文
浙公网安备 33010602011771号