摘要: 字符串搜索 可以暴力搜 主要是代码要精简点 参考了网上的代码优化后写出来的ac代码 1 #include 2 #include 3 #include 4 using namespace std; 5 int m,n; 6 int positionx; 7 int positiony; 8 char ... 阅读全文
posted @ 2014-08-09 22:11 acPlay 阅读(252) 评论(0) 推荐(0) 编辑
摘要: 转自 http://blog.csdn.net/xiaofengsheng/article/details/4813170欧几里德算法 欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。其计算原理依赖于下面的定理: 定理:gcd(a,b) = gcd(b,a mod b) 证明:... 阅读全文
posted @ 2014-07-24 09:45 acPlay 阅读(522) 评论(0) 推荐(0) 编辑
摘要: 1 //phi(a)=a*(a1-1)*(a2-1)*(a3-1)*...*(an-1)/(a1*a2*a3*...*an); 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 typedef __int64 ... 阅读全文
posted @ 2014-07-24 08:11 acPlay 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 费马小定理是数论中的一个重要定理,其内容为: 假如p是质数,且(a,p)=1,那么 a^(p-1) ≡1(mod p)。即:假如a是整数,p是质数,且a,p互质,那么a的(p-1)次方除以p的余数恒等于1。费马大定理,又被称为“费马最后的定理”,由法国数学家费马提出。它断言当整数n >2时,关于x,... 阅读全文
posted @ 2014-07-23 21:12 acPlay 阅读(671) 评论(0) 推荐(0) 编辑
摘要: 题目描述,例如13195的质因子有5,7,13,29,其中29是最大质因子,现在给你一个数600,851,475,143,,让你求它的最大质因子。这个数记为number,在2-sqrt(number)内先找出质因子然后让number除这些比较小的质因子不断的变小最后剩下的number%i==0的nu... 阅读全文
posted @ 2014-07-23 20:27 acPlay 阅读(516) 评论(0) 推荐(0) 编辑
摘要: 简单线段树插入和查询删除 1 #include 2 #include 3 #include 4 using namespace std; 5 int num[10000]; 6 int node[20000]; 7 int scale; 8 void clear(int n){ 9 scal... 阅读全文
posted @ 2014-07-22 21:23 acPlay 阅读(333) 评论(0) 推荐(0) 编辑
摘要: 遍历线段树 线段树的插入和查询 1 //城市地平线(线段树) 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 typedef __int64 LL; 9 struct building{... 阅读全文
posted @ 2014-07-22 20:44 acPlay 阅读(174) 评论(0) 推荐(0) 编辑
摘要: http://acm.hnu.cn/online/?action=problem&type=show&id=12812需要注意的细节很多 唉 看了modiz的代码 写出来的 自己代码能力太弱了 模拟题 atoi的头文件是stdio.h 1 #include 2 #include 3 #inclu... 阅读全文
posted @ 2014-07-21 17:19 acPlay 阅读(137) 评论(0) 推荐(0) 编辑
摘要: http://acm.hnu.cn/online/?action=problem&type=show&id=12833&courseid=268hnu 7/20 简单的题 小BUG y==2 时 n==x 时 不用再单独讨论 因为第一组数据可以看出 是我太傻逼 唉#include#include... 阅读全文
posted @ 2014-07-20 22:11 acPlay 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 typedef long long INT; 9 const INT MOD = 1000000007; 10 co... 阅读全文
posted @ 2014-07-20 10:19 acPlay 阅读(807) 评论(0) 推荐(0) 编辑