先放知识点: 莫比乌斯反演 卢卡斯定理求组合数 乘法逆元 快速幂取模 GCD of Sequence Alice is playing a game with Bob. Alice shows N integers a 1, a 2, -, a N, and M, K. She says each integers 1 ≤ a i ≤ M. And now Alice wants to ask for each d = 1 to M, how many different sequences b…
A Boring Question Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 156 Accepted Submission(s): 72 Problem Description Input The first line of the input contains the only integer T,(1≤T…
It is said that a dormitory with 6 persons has 7 chat groups ^_^. But the number can be even larger: since every 3 or more persons could make a chat group, there can be 42 different chat groups. Given N persons in a dormitory, and every K or more per…
Problem Description As we know, sequence in the form of an=a1+(n−1)d is called arithmetic progression and sequence in the form of bn=b1qn−1(q>1,b1≠0) is called geometric progression. Huazheng wants to use these two simple sequences to generate a simp…
Sumdiv Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 16466 Accepted: 4101 Description Consider two natural numbers A and B. Let S be the sum of all natural divisors of A^B. Determine S modulo 9901 (the rest of the division of S by 99…
G - Happy 2004 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1452 Description Consider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to dete…
题目链接: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…
C16H:Magical Balls 总时间限制: 1000ms 内存限制: 262144kB 描述 Wenwen has a magical ball. When put on an infinite plane, it will keep duplicating itself forever. Initially, Wenwen puts the ball on the location (x0, y0) of the plane. Then the ball starts to dup…
题目链接: https://cn.vjudge.net/problem/POJ-1845 题目大意: 求AB的因子和 解题思路: 先将A质因数分解,然后B次方的质因数指数就是乘上B即可 这里要mod9901,但是有除法,而且不一定有逆元,所以用公式: a/b mod m 等价于 a mod (m * b) / b 所以直接求出这个即可 但是mod m*b 这个数字可能很大,就算模上之后再相乘也会溢出,所以应该用有快速加法的快速幂 #include<iostream> #include<c…
Problem Description Considera positive integer X,and let S be the sum of all positive integer divisors of2004^X. Your job is to determine S modulo 29 (the rest of the division of S by29). Take X = 1 for an example. The positive integer divisors of 20…
题目来源 The 2018 ACM-ICPC China JiangSu Provincial Programming Contest 35.4% 1000ms 65536K Persona5 Persona5 is a famous video game. In the game, you are going to build relationship with your friends. You have N friends and each friends have his upper b…