Description has only two Sentences
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 199Accepted Submission(s): 9
Problem Description
an= X*an-1+
Y and Y mod (X-1) = 0.
Your task is to calculate the smallest positive integer k that akmod a0=
0.
Input
Each line will contain only three integers X, Y, a0( 1 < X < 231,
0 <= Y < 263, 0 < a0<
231).
Output
For each case, output the answer in one line, if there is no such k, output "Impossible!".
SampleInput
SampleOutput
(x^k-1)*(y/(x-1))=0(mod a0),再将(y/(x-1))和a0先消掉公因数,就是要求最小k满足x^k=1(mod m)
k^euler(m)=1(modm),找euler(m)的因数中能满足k^x=1(mod m)的最小x(快速幂)
循环节:a^b=a^(b+t) (mod c) -> a^t=1(mod c) -> 满足a^x=1(mod c) 则 x=t*k;(抽屉原理)
euler: a^euler=1(mod c)
好像也可以用什么离散对数做,反正我不知道那东东
分享到:
相关推荐
HDU的1250,主要是利用高精度加法,但是代码有点繁琐,效率不是很高
杭电ACMhdu1163
HDU1059的代码
hdu1001解题报告
hdu 1574 passed sorce
HDU的一题........HDU DP动态规
hdu2101AC代码
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
搜索 dfs 解题代码 hdu1241
hdu 5007 Post Robot 字符串枚举。 暴力一下就可以了。
hdu acm 教案 动态规划(1) hdu acm 教案 动态规划(1)
ACM HDU题目分类,我自己总结的大概只有十来个吧
hdu 1166线段树代码
HDU最全ac代码
自己做的HDU ACM已经AC的题目
hdu动态规划算法集锦
hdu题目分类
HDU图论题目分类
hdu-acm源代码(上百题)hdu-acm源代码、hdu-acm源代码hdu-acm源代码