随笔分类 - 数学
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2662 莫名其妙写了一个题,感觉还是很有价值的记录一下。 题目大意:给两个互质的数,求用无限个它们不能组成的最大的数题目分析:当定理记吧 ans=n*m-n-m 代码:
阅读全文
摘要:#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) { ...
阅读全文
摘要:#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...
阅读全文