Sumdiv (POJ - 1845,求 A^B 的约数和)

Sumdiv(唯一分解定理、逆元) 传送门 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 natural numbers A and B, (0 <= A,B <= 50000000)separated 阅读详情

一.题目链接:

POJ-1845

二.题目大意:

求 A^{B} 的约数和 mod 9901 (1\leq A,B\leq5e7)

题目简洁明了,就是不会做。

三.分析:

由唯一分解定理得:A 一定可以表示为 p_{1}^{c_{1}} \times p_{2}^{c_{2}} \times .....p_{n}^{c_{n}} 的形式.

那么  A^{B} 可表示为 p_{1}^{B\times c_{1}} \times p_{2}^{B\times c_{2}} \times .....p_{n}^{B\times c_{n}} 

因此,A^{B} 的约数为集合 \left \{ p_{1}^{k_{1}} \times p_{2}^{k_{2}} \times .....p_{n}^{k_{n}}\right \},其中 0\leq k_{i} \leq B \times c^{i} \ (1 \leq i \leq n)

根据乘法分配律,A^{B} 的所有约数之和就是: \prod_{i = 1}^{n}\sum_{j = 0}^{B\times c^{i}} p_{i} ^{\ j} 

上式每一括号内都是等比数列,现在就有两种解法:

① 求逆元

② 分治 + 递归

这里只介绍 ②

现欲使用分治法求  solve(p, c) = 1+p+p^{2}+....+p^{c} = \ ?

若 c 为奇数:

solve(p, c)= (1+p+....+p^{\frac{c-1}{2}})+(p^{\frac{c+1}{2}}+....+p^{c}) \\ = (1+p+....+p^{\frac{c-1}{2}})+ p^{​{\frac{c + 1}{2}}} (1+....+p^{​{\frac{c - 1}{2}}}) \\ = (1 + p + .... + p^{\frac{c -1}{2}}) (1 + p^{​{\frac{c + 1}{2}}}) \\ = solve(p,{\frac{c -1}{2}})(1 + p^{​{\frac{c + 1}{2}}})

若 c 为偶数:

solve(p, c) = solve(p, c - 1) + p^{c}

四.代码实现:

#include <set>
#include <map>
#include <ctime>
#include <queue>
#include <cmath>
#include <stack>
#include <vector>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define eps 1e-6
#define pi acos(-1.0)
#define ll long long int
using namespace std;

const int M = (int)2e3;
const int inf = 0x3f3f3f3f;
const ll mod = 9901;

ll quick(ll a, ll b)
{
    ll sum = 1;
    while(b)
    {
        if(b & 1)
            sum = sum * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return sum % mod;
}

ll solve(ll p, ll c)
{
    if(!c)
        return 1;
    if(c & 1)
        return solve(p, (c - 1) / 2) * (1 + quick(p, (c + 1) / 2)) % mod;
    else
        return (solve(p, c - 1) + quick(p, c)) % mod;
}

int main()
{
    ll a, b;
    while(~scanf("%lld %lld", &a, &b))
    {
        ll ans = 1;
        for(ll i = 2; i <= sqrt(a); ++i)
        {
            if(a % i == 0)
            {
                ll cnt = 0;
                while(a % i == 0)
                {
                    cnt++;
                    a /= i;
                }
                ans = ans * solve(i, cnt * b) % mod;
            }
        }
        if(a != 1)
            ans = ans * solve(a, b) % mod;
        printf("%lld\n", ans);
    }
    return 0;
}

 

「一本通 6.4 例 3」Sumdiv 快速幂+逆元+等比数列求和。 阅读详情

相关推荐

io_uring vs epoll ,谁在网络编程领域更胜一筹?

简介:从定量分析的角度,通过量化 io_uring 和 epoll 两种编程框架下的相关操作的耗时,来分析二者的性能差异。 本文作者:王小光,「高性能存储技术SIG」核心成员。 背景 io_uring 在传统存储 io 场景已经证明其价值,但 io_uring 不仅支持传统存储 io,也支持网络 io。io_uring 社区有众多的开发者尝试将 io_uring 用于网络应用。我们之前也在《你认为 io_uring 只适用于存储 IO?大错特错!》中也探索过 io_uring 在网络场景的应用及其

阿里云云栖号 3035

[质因数分解][除法取余]Sumdiv LibreOJ10211

题目描述 原题来自:Romania OI 2002 求 A^B 的所有约数之和 mod 9901。 输入格式 输入两个整数 A,B。 输出格式 输出答案 mod9901。 样例 Input Output 2 3 15 2^3=8,8 的所有约数为 1,2,4,8,15 mod 9901=15,因此输出 15。 数据范围与提示 对于全部数据,0≤A,B≤5×10^7。 题意: 输出A^B全部因数的和除9901的余数。 分析: 这个

Cloth的博客 763

【项目案例】前后端分离项目 【Web图书管理系统 】SpringBoot + Vue + Element UI + Mysql

Web图书管理系统

激流丶的博客 5397

Sumdiv(数论,快速幂)

Sumdiv 题意:给出两个数n,mn,mn,m,求nmn^mnm的全部因子的和SSS对990199019901取模的结果。 结论: 1.任意自然数都可以拆成质因子乘积的形式,nm=a1b1∗m∗a2b2∗m...∗anbk∗m1.任意自然数都可以拆成质因子乘积的形式,n^m = {a_1}^{b_1*m}*{a_2}^{b_2*m}...*{a_n}^{b_k*m}1.任意自然数都可以拆成质因子乘积的形式,nm=a1​b1​∗m∗a2​b2​∗m...∗an​bk​∗m 其中a1,a2...ak都是n的质

weixin_45363113的博客 836

用R语言做WGCNA分析全步骤一(附代码解读)【转载】

代码逐句分析一、文章来源二、基因共表达网络构建及模块识别1.数据导入、清洗及预处理2.检查过度缺失值和离群样本3.聚类做离群样本检测4.载入临床特征数据三、自动构建网络及识别模块1.确定合适的软阈值:网络拓扑分析2.一步构建网络和识别模块 一、文章来源 初学WGCNA,觉得博主的代码写的很不错,但其中很多代码在第一遍看的时候有很多地方不理解,后查阅了很多资料,终于看明白了,于是写了一篇笔记,记录自己的学习心得,有不准确的地方,还望各位大佬们不吝赐教~ 原文链接:WGCNA简明指南 二、基因共表达网络构建及模

qq_43138237的博客 2万+

基于单片机的自动喷淋系统设计【毕业设计】

随着人民生活质量提高与生活节奏的加快,城市居民对于花草绿植的家庭培养与装饰需求增加,随之因浇灌植物的需要,智能浇花系统的市场逐渐扩大。现有自动浇花系统大部分只能通过设置固定浇水时间而难以实现适时、适量浇水,或在植物环境土壤含水量低时进行报警而并不能实际补水。为克服局限性而设计以单片机为控制中心的自动浇花系统。通过湿度传感器检测目标植物环境土壤湿度数据,再经ADCO832将其放大转换为数字量,由单片机读取输出向LCD1602 显示屏显示并通过比对键盘向单片机所设置的湿度范围而利用中断服务程序进行补水需求判断。

qq_48771816的博客 1711

Sumdiv ( 求因子和+逆元)

题目 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...

weixin_43823476的博客 311

避坑指南!YOLO26模型导出/推理常见问题,99%的开发者都踩过

版本锁定:Ultralytics=8.4.2、OpenVINO=2024.0.0、Python=3.10,版本不一致是80%问题的根源;参数对齐:训练/导出/推理的imgsz、归一化、坐标映射必须完全一致,差一步就出错;算子统一:避免自定义算子,优先用YOLO26原生算子(C3k2/PSABlock),确保推理引擎兼容;分步验证:导出后先校验ONNX/IR模型→单图片推理→RTSP流推理→72小时稳定性测试,一步过易踩坑;工业级测试。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 510

POJ 1845 Sumdiv(数论,求A^B的所有约数和)

Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10071   Accepted: 2357 Description Consider two natural numbers A and B. Let S be the sum of all natural...

weixin_33758863的博客 187

基于知识图谱的时空事件关联推理能力培养

随着信息技术的飞速发展,大量的时空事件数据被产生和收集,如交通流量数据、气象观测数据、社交媒体上的地理定位信息等。这些数据蕴含着丰富的知识和规律,但要从中提取有价值的信息并非易事。基于知识图谱的时空事件关联推理旨在通过构建知识图谱,将时空事件数据进行整合和关联,从而实现对事件之间潜在关系的挖掘和推理。本文的目的是系统地介绍基于知识图谱的时空事件关联推理能力的培养方法,包括核心概念、算法原理、数学模型、实际应用等方面。

操作系统内核探秘的博客 750

量子化学仿真软件:VASP_(7).表面与界面性质模拟

在量子化学仿真软件领域,表面与界面性质的模拟是研究多相催化、表面反应、材料科学等领域的关键工具。VASP(Vienna Ab Initio Simulation Package)作为一种广泛使用的密度泛函理论(DFT)计算软件,提供了强大的功能来模拟表面与界面的性质。本节将详细介绍如何使用VASP进行表面与界面性质的模拟,包括模型构建、输入文件准备、计算设置、结果分析等步骤。

kkchenjj的博客 950

(Relax 数论1.23)POJ 1845 Sumdiv(求A^B的约数之和)

本文的分析部分参考了http://blog.youkuaiyun.com/lyy289065406/article/details/6648539 大致题意: 求A^B的所有约数(即因子)之和,并对其取模 9901再输出。   解题思路: 要求有较强 数学思维 的题 应用定理主要有三个: 要求有较强 数学思维 的题 应用定理主要有三个: (1)   整

黄俊东的专栏 1302

Vue3 - 详解实现网站接入钉钉扫码登录功能,钉钉授权生成登录二维码用户用手机扫描二维码登陆,支持弹框式、浏览器单独新开页显示,钉钉扫描二维码登录详细流程及示例代码,最新vue集成钉钉扫码授权登录!

vue3,nuxt3,钉钉,扫码登录,vue3钉钉扫码登陆,钉钉授权第三方WEB网站扫码登录功能,钉钉扫码登录第三方网站,单点登录,二维码不显示,报错,扫了没反应,出错,vue3钉钉扫码登录,内嵌,获取个人信息,pc网页钉钉登录,钉钉扫码登录怎么新开一页,跳页显示二维码,内嵌登录二维码,iframe新页面弹出,弹出一个小窗口显示登录二维码,登录报错,扫码没反应,解决手机点登录报错没反应,官方文档,手机扫描钉钉二维码登录网站,页面弹出一个小窗口而不是打开一个页面,vue3中使用iframe实现另开小窗口扫码登

🏆 前端领域优质创作者 3694

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

POJ1845 Sumdiv - 乘法逆元+快速幂【A^B的约数个数和】

POJ1845 Sumdiv Sol: 约数个数和\(sumdiv=(1+p_1+p_1^2+\dots + p_1^{c_1})*\dots *(1+p_k+p_k^2+\dots + p_k^{c_k})\) 其中每一项都是一个首项为1,公比为\(p_i\)的等比数列的和,即 \(1*\frac{1-p_i^{c_{k}+1}}{1-p_i}=\frac{p_i^{c_{k}+1}-...

dmqqndlx85675的博客 194

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

poj 1845 Sumdiv

poj 1845 Sumdiv 题意: 给出两个数a,b,求a^b的约数的和,结果模9901。 限制: 0 思路: 约数和公式: 对于已经分解的整数a=(p1^k1)*(p2^k2)*(p3^k3)*....*(pn^kn) 则,a的所有约数之和为 S=(1+p1+p1^2+p1^3+...p1^k1) * (1+p2+p2^2+p2^3+….p2^k2) * (1+p

whai的专栏 700

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

POJ1845 Sumdiv 递归

题目链接 http://poj.org/problem?id=1845 分析 将 AAA 分解质因数为 p1c1∗p2c2∗...∗pncnp_1 ^ {c_1} * p_2 ^ {c_2} * ... * p_n ^ {c_n}p1c1​​∗p2c2​​∗...∗pncn​​,则 ABA ^ BAB 为 p1B∗c1∗p2B∗c2∗...∗pnB∗cnp_1 ^ {B * c_1} * p_2...

Kevin的博客 295

poj 1845 POJ 1845 Sumdiv 数学模板

筛选法+求一个整数的分解+快速模幂运算+递归求计算1+p+p^2+````+p^nPOJ 1845 Sumdiv求A^B的所有约数之和%9901 */#include<stdio.h>#include<math.h>#include<iostream>#include<algorithm>#include<string.h>u...

dianche1354的博客 157

POJ---1845:Sumdiv【因数和定理】

题意: 求 A^B 的所有约数和,输出结果 mod 9901 分析: 约数和定理: A^B 的质因子无非是A的每个质因子的个数扩大了B倍,直接套公式,等比数列求和有: ,模数太小,pi - 1可能和9901不互质,就不能通过逆元来求,下面给出两种解法: 求解: (1) 上面公式仅在 b|a 时成立,我们可以反向验证这个公式 设 x = a / b,则 a = b ...

KobeDuu 518

【POJ1845】Sumdiv——杨子曰题目

【POJ1845】Sumdiv——杨子曰题目 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 conta...

杨子曰:代码是神奇的 377

POJ1845:Sumdiv

点击打开题目链接 Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 11902   Accepted: 2859 Description Consider two natural numbers A and B. Let S b

I just want to AC you~~~ 1151

POJ 1845 Sumdiv(数论)

Sumdiv Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 15745   Accepted: 3894 Description Consider two natural numbers A and B. Let S be the sum of all natur

叶孤心的专栏 3163

【POJ 1845】sumdiv约数和

1831: 【POJ 1845】sumdiv约数和 题目描述 给定两个自然数A和B,S为AB的所有正整数约数和,编程输出S mod 9901的结果。 输入 只有一行,两个用空格隔开的自然数A和B(0<=A,B<= 50,000,000)。 输出 只有一行,即S mod 9901的结果。 样例输入 2 3 样例输出 15 首先,我们得知道A的约数 ...

砥安的博客 188

POJ 1845 Sumdiv (快速分解因式+快速幂取模)

题目地址:POJ 1845 转载自:http://blog.youkuaiyun.com/lyy289065406/article/details/6648539 大致题意: 求A^B的所有约数(即因子)之和,并对其取模 9901再输出。   解题思路: 要求有较强 数学思维 的题 应用定理主要有三个: 要求有较强 数学思维 的题 应用定理主要有三个:

scf0920 1005

POJ 1845 Sumdiv 【整数的素数分解+逆元+快速幂+约数和公式】

题目链接:http://poj.org/problem?id=1845 题意:求A^B的约数和,结果取余 思路: 整数的素数分解:任意一个整数都能通过若干个素数相乘得到,n = p1^a1 * p2 ^a2 * p3^a3 *..... pk^ak;相应的代码模板可以自己网上找找,也可以参考下面的代码 (能将一个整数的所有pi 和 ai 求出并存入数组中) 逆元:平常做的取模运算条件是 a...

Y390d的博客 300
上一篇: Mistwald( ZOJ - 3497,这也能用矩阵快速幂?!)
下一篇: To the Max( POJ - 1050,子矩阵最大和 模拟 || 降维 + 最大子段和)
The___Flash
博客等级 码龄8年 79粉丝 223原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值