题目链接:https://loj.ac/problem/6392 题目大意:给定五个正整数c1,c2,e1,e2,N,其中e1与e2互质,且满足 c1 = m^e1 mod N c2 = m^e2 mod N 求出正整数m 解题思路:因为e1与e2互质,所以可以找到两个整数x,y,满足e1x+e2y=1 所以m^(e1x+e2y)=m^1=m=c1^x*c2^y; 注意如果x或者y小于0时,需要求c1.c2对N的逆元 因为N的范围很大,小于2的63次方,所以不能直接乘,需要用快速乘. 求逆元的时…
链接:https://www.nowcoder.com/acm/contest/106/B 来源:牛客网 题目描述 It's universally acknowledged that there're innumerable trees in the campus of HUST. One day Xiao Ming is walking on a straight road and sees many trees line up in the right side. Heights of e…
题目链接 Description Given a n × n matrix A and a positive integer k, find the sum S = A + A^2 + A^3 + - + A^k. Input The input contains exactly one test case. The first line of input contains three positive integers n (n ≤ 30), k (k ≤ 109) and m (m < 10…