摘要: #include #include // 最大顶点数const int V = 100000;// 最大边数const int E = 100000;// 边结构体的定义struct Edge { int to; // 表示这条边的另外一个顶点 ... 阅读全文
posted @ 2018-08-26 23:21 MCQ 阅读(101) 评论(0) 推荐(0) 编辑
摘要: m^p≡mmodp,n^p≡nmodp,所以m^p+n^p≡(m+n)modp#includeusing namespace std;#define inf 0x3f3f3f3f#define ll long longconst int maxn=200005;con... 阅读全文
posted @ 2018-08-26 17:48 MCQ 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 费马小定理(Fermat's little theorem)是数论中的一个重要定理,在1636年提出,其内容为: 假如p是质数,且gcd(a,p)=1,那么 a^(p-1)≡1(mod p),例如:假如a是整数,p是质数,则a,p显然互质(即两者只有一个公约数1),那... 阅读全文
posted @ 2018-08-26 17:29 MCQ 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 思路:由费马大定理知a^n+b^n=c^n当n>2时无整数解,所以n==0和n>2时输出-1 -1,n==1时输出1,a+1,n==2时,由奇偶数列法(https://blog.csdn.net/Dilly__dally/article/details/8208192... 阅读全文
posted @ 2018-08-26 16:42 MCQ 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 定理: 如a^2+b^2=c^2是直角三角形的三个整数边长,则必有如下a值的奇数列、偶数列关系成立; (一) 直角三角形a^2+b^2=c^2奇数列a法则: 若a表为2n+1型奇数(n=1、2、3 …), 则a为奇数列平方整数解的关系是: a=2... 阅读全文
posted @ 2018-08-26 16:40 MCQ 阅读(1354) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;#define inf 0x3f3f3f3f#define ll long longconst int maxn=200005;const double eps=1e-8;const double PI = ac... 阅读全文
posted @ 2018-08-26 15:11 MCQ 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 题意:给定n天,每天有个价格,可以买一个物品,可以把手中的物品卖掉,求最大利润和最少买卖次数。思路:最大利润按这个https://blog.csdn.net/Dilly__dally/article/details/82055866思路求,先看第二个样例9 5 9 1... 阅读全文
posted @ 2018-08-26 12:07 MCQ 阅读(116) 评论(0) 推荐(0) 编辑