摘要: 快速幂模+佩尔方程#include #include #include #include const int Mod=8191;struct Matrax { int m[3][3];};Matrax a,per;void slove(int d,int &x1,int &y1){ y1=1; wh... 阅读全文
posted @ 2014-09-04 21:04 chenjunjie1994 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 作弊了--!该题可以通过因式分解得到一个佩尔方程。。。。要不是学着这章,估计想不到。。得到x1,y1后,就直接代入递推式递推了x[n]=x[n-1]*x[1]+d*y[n-1]*y[1]y[n]=x[n-1]*y[1]+y[n-1]*x[1]#include #include #include #i... 阅读全文
posted @ 2014-09-04 20:33 chenjunjie1994 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 求本原毕达三原组的个数以及不是毕达三元组的数。这道题需要把规模降下来,由x=m^2-n^2y=2mnz=m^2+n^2由有x+y#include #include #include #include using namespace std;const int Maxn=1000010;bool fl... 阅读全文
posted @ 2014-09-04 19:56 chenjunjie1994 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 这题确实是好。其实是求x1*a1+x2*a2+....M*xn+1=1有解的条件。很明显,就是(a1,a2,...M)=1了。然后,可以想象,直接求有多少种,很难,所以,求出选择哪些数一起会不与M互质。。。好吧,思路就到这里了。。。T_T经过人提示,若(a1,a2,,,,an)与M不互质,则最大公约... 阅读全文
posted @ 2014-09-04 15:57 chenjunjie1994 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 这道题的难点在于求|x|+|y|的为最小的值吧。想了好久才想出来,发现自己的数学能力确实跟不上。可知。x=x0+b/d*t;y=y0-a/d*t;则为|x0+b/d*t|+|y0-a/d*t|,仔细想想,可以看成的是两条直线方程y绝对值之和。那么,必然最小值只能出现在两条直线方程的两个零点之间,则枚... 阅读全文
posted @ 2014-09-04 11:33 chenjunjie1994 阅读(152) 评论(0) 推荐(0) 编辑