唯一分解定理
newhonor
可以不伟大,但不能卑微
展开
-
Aladdin and the Flying Carpet
https://cn.vjudge.net/problem/LightOJ-1341 题意:给矩形的面积和最小边,问有多少种矩形; 思路:将面积素因子分解,各因子的指数+1的乘积就是其因子种数sum;再减去小于最小边的; x=p1^a1+....p1^ai; 因子种数:sum=(a1+1)*(a2+1).... #include<algorithm> #include&l...原创 2019-04-02 18:02:58 · 80 阅读 · 0 评论 -
细胞分裂
https://ac.nowcoder.com/acm/contest/948/A 思路:化简即:(s^k)%(m1^m2) ==0最小的k;将m1素因子分解,再逐个s分解判断; 反思:不能先将s全部分解保存再逐个判断Min,会tle。 #include<algorithm> #include<set> #include<cmath> #inclu...原创 2019-07-07 15:42:55 · 487 阅读 · 0 评论 -
Divisors of the Divisors of an Integer
http://codeforces.com/gym/102040 思路:这种题一般素因子分解看看行不行的了。。n!==p1^a1*p2^a2....假设为3^a1*5^a2;那么因为素因子的d(x)=2;而3^a1表示因子可以为:3^0,3^1,3^2.....共a+1个;而发现这些的d(3^i)=i+1;就是1~a+1;那么求和就是(a+1)(a+2)/2;也可以理解成每次多了个3因子,就是...原创 2019-07-20 16:02:06 · 596 阅读 · 0 评论