[POJ 1845] Sumdiv 用的东西挺全 最主要通过这个题学了约数和公式跟二分求等比数列前n项和 另一种小优化的整数拆分  整数的唯一分解定理: 随意正整数都有且仅仅有一种方式写出其素因子的乘积表达式. A=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn)   当中pi均为素数 约数和公式: 对于已经分解的整数A=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn) 有A的全部因子之和为 S = (1+p1+p1^2+p1^3+...p1^k1…
传送门:http://poj.org/problem?id=1845 大致题意: 求A^B的所有约数(即因子)之和,并对其取模 9901再输出. 解题基础: 1) 整数的唯一分解定理: 任意正整数都有且只有一种方式写出其素因子的乘积表达式. ,其中为素数 2) 约数和公式: 对于已经分解的整数,A的所有因子之和为 3) 同余模公式: (a+b)%m=(a%m+b%m)%m (a*b)%m=(a%m*b%m)%m 1: 对A进行素因子分解 这里如果先进行筛50000内的素数会爆空间,只能用最朴素的…
筛选法+求一个整数的分解+快速模幂运算+递归求计算1+p+p^2+````+p^nPOJ 1845 Sumdiv求A^B的所有约数之和%9901 */#include<stdio.h>#include<math.h>#include<iostream>#include<algorithm>#include<string.h>using namespace std;#define MOD 9901const int MAXN=10000;int p…
Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 13959   Accepted: 3433 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…
Sumdiv Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1845 Appoint description:   System Crawler  (2015-05-27) Description Consider two natural numbers A and B. Let S be the sum of all natural…
题目链接 题意:求 A^B的所有约数之和对9901取模后的结果. 分析: 看了小优的博客写的. 分析来自 http://blog.csdn.net/lyy289065406/article/details/6648539 (1)   整数的唯一分解定理: 任意正整数都有且只有一种方式写出其素因子的乘积表达式. A=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn)   其中pi均为素数 (2)   约数和公式: 对于已经分解的整数A=(p1^k1)*(p2^k2)*(p3^…
Sumdiv 题目连接: http://poj.org/problem?id=1845 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 9901). Input The only line contains the two natur…
题目链接 Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 25841   Accepted: 6382 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…
题目: 求AB的正约数之和. 输入: A,B(0<=A,B<=5*107) 输出: 一个整数,AB的正约数之和 mod 9901. 思路: 根据正整数唯一分解定理,若一个正整数表示为:A=p1^c1 * p2^c2 * ...... pm^cm 则其正约数之和可以表示为:S=(1+p1+p1^2+......p1^c1)*(1+p2+p2^2+......p2^c2)*......(1+pm+pm^2+......pm^cm) 那么AB就可以表示为:S'=(1+p1+p1^2+......p1…
当我们拆分完数据以后, A^B的所有约数之和为: sum = [1+p1+p1^2+...+p1^(a1*B)] * [1+p2+p2^2+...+p2^(a2*B)] *...*[1+pn+pn^2+...+pn^(an*B)]. 当时面对等比数列的时候,想到了求和公式,因为直接算超时了,但是带膜除法不能直接除,所以又想到了乘法逆元,但是逆元的使用条件是除数和mod互质的时候,题目给我们的膜不够大,然后我就方了,不知道该怎么去处理了,后来看到网上,才学会了等比快速求和的方法. 它的思想是二分法…