
第四天同余 逆元
小青龙8085
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
D - 3的幂的和 快速幂+费马小定理 或 快速幂+扩展欧几里得
求:3^0 + 3^1 +...+ 3^(N) mod 1000000007Input输入一个数N(0 <= N <= 10^9)Output输出:计算结果Sample Input3Sample Output40 费马小定理 1.mod=质数 2.a与mod互质 则a的逆元为a的p-2次方;#include<bit...原创 2018-07-24 20:13:29 · 242 阅读 · 0 评论 -
B - A/B 扩展欧几里德
要求(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-24 20:19:53 · 165 阅读 · 0 评论 -
F - Large Division 大数取模
Given 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....原创 2018-07-24 20:58:11 · 213 阅读 · 0 评论 -
E - Integer Divisibility 大数取模之找大数
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-24 21:01:51 · 169 阅读 · 0 评论 -
C - 乘法逆元 求逆元
给出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-24 21:04:47 · 3448 阅读 · 0 评论