码迷,mamicode.com
首页 >  
搜索关键字:prime cryptarithm    ( 2476个结果
判断质数的几种方法
根据维基百科定义,质数(Prime number),又称素数,指在大于1的自然数中,除了1和此整数自身外,无法被其他自然数整除的数(也可定义为只有1和本身两个因数的数)。比1大但不是素数的数称为合数。1和0既非素数也非合数。质数在公钥加密算法(如RSA)中有重要的地位。 下边将会介绍几种较为常...
分类:其他好文   时间:2015-03-12 22:17:57    阅读次数:217
数学上用到的一些小模版
欧几里得求公约数:int gcd(int a, int b){ while (b) { int tmp = b; b = a % b; a = tmp; } return a;}筛选法求素数:int prime(){ memse...
分类:其他好文   时间:2015-03-12 18:32:57    阅读次数:99
hdu 1492 The number of divisors(约数) about Humble Numbers 数论~~
Problem Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers. Now given a humble number, please w...
分类:其他好文   时间:2015-03-12 17:17:24    阅读次数:128
C++ Prime:sizeof运算符
sizeof运算符的结果部分地依赖于其作用的类型: 对char或者类型为char的表达式执行sizeof运算结果得1; 对引用类型执行sizeof运算得到被引用对象所占空间的大小; 对指针执行sizeof运算得到指针本身所占空间的大小; 对解引用指针执行sizeof运算得到指针指向的对象所占...
分类:编程语言   时间:2015-03-12 06:22:07    阅读次数:143
C++ Prime:范围for语句
C++11新标准引入了一种更简单的for语句,这种语句可以遍历容器或者其他序列的所有元素。范围for语句的语法形式是: for( declaration : expression) statement expression表示的必须是一个序列,序列中的每个元素都能转换成该变量的类型。确...
分类:编程语言   时间:2015-03-12 06:19:35    阅读次数:144
C++ Prime:switch内部的变量定义
如果需要为某个case分支定义并初始化一个变量,我们应该把变量定义在块内,从而确保后面的所有case标签都在变量的作用域之外。case true: { // 正确,声明语句位于语句块内部 string file_name = get_file_name(...
分类:编程语言   时间:2015-03-12 06:17:18    阅读次数:145
BZOJ 2820 YY的GCD
#include #include #include using namespace std; typedef long long LL; const int maxn = 10000010; int mu[maxn], prime[maxn], vis[maxn], sum[maxn]; int cnt; int a, b; void mobi(int n) { mu[1] = 1;...
分类:其他好文   时间:2015-03-11 17:29:53    阅读次数:113
莫比乌斯模版
#include #include #include using namespace std; typedef long long LL; const int maxn = 100010; int mu[maxn], prime[maxn], vis[maxn]; int cnt; int a, b, c, d, k; void mobi(int n) { mu[1] = 1; for(...
分类:其他好文   时间:2015-03-11 17:29:36    阅读次数:147
HDU Prime Ring Problem _DFS
1 #include 2 #include 3 #include 4 #define M 21 5 #define sc(x) scanf("%d",&x) 6 #define pf(x) printf("%d\n",x) 7 #define PF(x) printf("%d ",x) 8 #de....
分类:其他好文   时间:2015-03-11 16:22:04    阅读次数:222
C++ Prime:预处理器
C++程序会用到的一项预处理功能是头文件保护符,头文件保护符依赖于预处理变量。预处理变量有两种状态:已定义和未定义,#define指令把一个名字设定为预处理变量,另外两个指令则分别检查某个指定的预处理变量是否已经定义:#ifdef当且仅当变量已定义的时候为真,#inndef当且仅当变量未定义时为.....
分类:编程语言   时间:2015-03-11 01:56:02    阅读次数:132
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!