摘要: 参考文章来源:Reait Home(http://www.reait.com/blog.html) 转载请注明,谢谢合作。 在Miller Rabbin测试素数,就用到了快速幂取模的思想。这里总结下。求a^b%c(这就是著名的RSA公钥的加密方法),当a,b很大时,直接求解这个问题不太可能 算法1: 阅读全文
posted @ 2014-12-27 21:27 SenberHu 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1 #include <assert.h> //设定插入点 2 #include <ctype.h> //字符处理 3 #include <errno.h> //定义错误码 4 #include <float.h> //浮点数处理 5 #include <fstream.h> //文件输入/输出 6 阅读全文
posted @ 2014-12-27 20:42 SenberHu 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 求最大公约数和最小公倍数的经典算法--辗转相除法描述如下: 若要求a,b两数的最大公约数和最小公倍数,令a为a、b中较大数,b为较小数,算法进一步流程: while(b不为0) { temp=a%b; a=b; b=temp } 最后a即为两数的最大公约数,最大公倍数为: a*b/最大公约数 c语言 阅读全文
posted @ 2014-12-27 20:37 SenberHu 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 水的不行不行的一道题 也是自己做的第一道题 纪念下 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 int main() 5 { 6 int n, sum, k, count; 7 int z[2002]; 8 memset 阅读全文
posted @ 2014-12-27 20:31 SenberHu 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 对于 新手的我来说 写起来 还是有一点吃力 好在写出来了! 1 #include<stdio.h> 2 int main() 3 { 4 int m; 5 scanf( "%d" , &m ); 6 int a[50000] = {0,1}; 7 //static int a[50000]={0,1 阅读全文
posted @ 2014-12-27 18:57 SenberHu 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 这道题 用位运算必然简单 但是苦逼的是自己不熟练 那就 用本办法 输入一个十进制数 转换成二进制翻转 去掉高位的零 然后再转化为十进制 输出! 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 int main() 5 { 6 阅读全文
posted @ 2014-12-27 18:52 SenberHu 阅读(335) 评论(0) 推荐(0) 编辑