
同余定理 + 逆元
HPU2_2
这个作者很懒,什么都没留下…
展开
-
hdu 1576
要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input2...原创 2018-07-26 20:38:45 · 110 阅读 · 0 评论 -
51 nod 2516
给出2个数M和N(M < N),且M与N互质,找出一个数K满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的。Input输入2个数M, N中间用空格分隔(1 <= M < N <= 10^9)Output输出一个数K,满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的...原创 2018-07-26 20:39:52 · 131 阅读 · 0 评论 -
51nod 1013
求:3^0 + 3^1 +...+ 3^(N) mod 1000000007Input输入一个数N(0 <= N <= 10^9)Output输出:计算结果Sample Input3Sample Output40// 视为等比数列 和为 (1 - q^n)/(1-q) 在本题中 (3^n - 1)/2mod 1000000007//A/B%m...原创 2018-07-26 20:40:54 · 199 阅读 · 0 评论 -
E - Integer Divisibility LightOJ - 1078
If an integer is not divisible by 2 or 5, some multiple of that number in decimal notation is a sequence of only a digit. Now you are given the number and the only allowable digit, you should report t...原创 2018-07-26 20:42:11 · 99 阅读 · 0 评论 -
F - Large Division LightOJ - 1214
iven two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c.I...原创 2018-07-26 20:42:52 · 135 阅读 · 0 评论