随笔分类 -  基础数学

摘要:http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=232#problem/BWe all know that a pair of distinct points on a plane defines a line and that ... 阅读全文
posted @ 2014-08-14 10:24 HuberyQian 阅读(150) 评论(0) 推荐(0)
摘要:D -C Looooopshttp://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=212#problem/D#include #includeusing namespace std;long long exgcd(long long a,... 阅读全文
posted @ 2014-08-07 19:27 HuberyQian 阅读(307) 评论(0) 推荐(0)
摘要:1.求gcd,算法为欧几里德(辗转相除法)2.解一元二次方程,算法为扩展欧几里德3.求素数,算法为埃氏筛法4.快速进行幂运算,算法快速幂(反复平方)5.解线性同余方程,求逆元(基于exgcd)6.其它用来优化模运算的定理,欧拉定理(费马小定理),相应的函数欧拉函数 阅读全文
posted @ 2014-08-07 11:01 HuberyQian 阅读(132) 评论(0) 推荐(0)
摘要:#include #include long long gcd(long long x,long long y){ if(y==0) { return x; } return gcd(y,x%y);}void extended_gcd(long long a,l... 阅读全文
posted @ 2014-08-07 09:29 HuberyQian 阅读(170) 评论(0) 推荐(0)
摘要:#includeint extended_gcd(int a,int b,int &x,int &y){ int r,t; if(!b) { x = 1; y = 0; return a; } r = extended_gcd(... 阅读全文
posted @ 2014-08-06 11:08 HuberyQian 阅读(130) 评论(0) 推荐(0)