随笔分类 -  数学

摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2662 莫名其妙写了一个题,感觉还是很有价值的记录一下。 题目大意:给两个互质的数,求用无限个它们不能组成的最大的数题目分析:当定理记吧 ans=n*m-n-m 代码: 阅读全文
posted @ 2016-12-07 20:42 a_clown_cz 阅读(110) 评论(0) 推荐(0)
摘要:线性筛法: N在10^6之内 或者更大 阅读全文
posted @ 2016-09-28 19:52 a_clown_cz 阅读(117) 评论(0) 推荐(0)
摘要:#include using namespace std; int quickMod(int a,int b,int m) { int ans=1; a%=m; // a%=m;这里最好处理一下 while(b) { //如果a是一个很大的数的话, if(b&1) { ... 阅读全文
posted @ 2016-09-28 19:45 a_clown_cz 阅读(99) 评论(0) 推荐(0)
摘要:#include #include #include #include using namespace std; #define ll long long int gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); } void exgcd(ll a,ll b,ll &x,ll &y) { if(b==0) { x=1... 阅读全文
posted @ 2016-09-28 19:07 a_clown_cz 阅读(112) 评论(0) 推荐(0)